mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ chg: Full Work Area Mode (F11) -> Full Screen Mode
This commit is contained in:
parent
7bb62ded8b
commit
6ac1eccef1
@ -1 +1 @@
|
||||
2631
|
||||
2632
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.19.912.2631"
|
||||
version="5.19.913.2632"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 BETA</description>
|
||||
|
||||
@ -3240,14 +3240,14 @@ WININFO GetMyWindowPlacement(HWND hwnd, MONITORINFO* hMonitorInfo)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// FitIntoMonitorWorkArea()
|
||||
// FitIntoMonitorGeometry()
|
||||
//
|
||||
void FitIntoMonitorWorkArea(RECT* pRect, WININFO* pWinInfo, bool bFullWorkArea)
|
||||
void FitIntoMonitorGeometry(RECT* pRect, WININFO* pWinInfo, SCREEN_MODE mode)
|
||||
{
|
||||
MONITORINFO mi;
|
||||
GetMonitorInfoFromRect(pRect, &mi);
|
||||
|
||||
if (bFullWorkArea) {
|
||||
if (mode == SCR_FULL_WORKAREA) {
|
||||
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);
|
||||
@ -3255,6 +3255,14 @@ void FitIntoMonitorWorkArea(RECT* pRect, WININFO* pWinInfo, bool bFullWorkArea)
|
||||
pWinInfo->cx = (mi.rcWork.right - mi.rcWork.left);
|
||||
pWinInfo->cy = (mi.rcWork.bottom - mi.rcWork.top);
|
||||
}
|
||||
else if (mode == SCR_FULL_SCREEN) {
|
||||
SetRect(pRect, mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom);
|
||||
// monitor coord -> screen coord
|
||||
pWinInfo->x = mi.rcMonitor.left - (mi.rcWork.left - mi.rcMonitor.left);
|
||||
pWinInfo->y = mi.rcMonitor.top - (mi.rcWork.top - mi.rcMonitor.top);
|
||||
pWinInfo->cx = (mi.rcMonitor.right - mi.rcMonitor.left);
|
||||
pWinInfo->cy = (mi.rcMonitor.bottom - mi.rcMonitor.top);
|
||||
}
|
||||
else {
|
||||
WININFO wi = *pWinInfo;
|
||||
WinInfoToScreen(&wi);
|
||||
@ -3287,7 +3295,7 @@ void FitIntoMonitorWorkArea(RECT* pRect, WININFO* pWinInfo, bool bFullWorkArea)
|
||||
// WindowPlacementFromInfo()
|
||||
//
|
||||
//
|
||||
WINDOWPLACEMENT WindowPlacementFromInfo(HWND hwnd, const WININFO* pWinInfo)
|
||||
WINDOWPLACEMENT WindowPlacementFromInfo(HWND hwnd, const WININFO* pWinInfo, SCREEN_MODE mode)
|
||||
{
|
||||
WINDOWPLACEMENT wndpl;
|
||||
ZeroMemory(&wndpl, sizeof(WINDOWPLACEMENT));
|
||||
@ -3298,7 +3306,7 @@ WINDOWPLACEMENT WindowPlacementFromInfo(HWND hwnd, const WININFO* pWinInfo)
|
||||
if (pWinInfo) {
|
||||
RECT rc = RectFromWinInfo(pWinInfo);
|
||||
winfo = *pWinInfo;
|
||||
FitIntoMonitorWorkArea(&rc, &winfo, false);
|
||||
FitIntoMonitorGeometry(&rc, &winfo, SCR_NORMAL);
|
||||
if (pWinInfo->max) { wndpl.flags &= WPF_RESTORETOMAXIMIZED; }
|
||||
}
|
||||
else {
|
||||
@ -3308,7 +3316,7 @@ WINDOWPLACEMENT WindowPlacementFromInfo(HWND hwnd, const WININFO* pWinInfo)
|
||||
else
|
||||
GetWindowRect(GetDesktopWindow(), &rc);
|
||||
|
||||
FitIntoMonitorWorkArea(&rc, &winfo, true);
|
||||
FitIntoMonitorGeometry(&rc, &winfo, mode);
|
||||
// TODO: maximize ?
|
||||
}
|
||||
wndpl.rcNormalPosition = RectFromWinInfo(&winfo);
|
||||
|
||||
@ -41,8 +41,8 @@ bool WarnIndentationDlg(HWND hwnd, EditFileIOStatus* fioStatus);
|
||||
bool GetMonitorInfoFromRect(const RECT* rc, MONITORINFO* hMonitorInfo);
|
||||
void WinInfoToScreen(WININFO* pWinInfo);
|
||||
WININFO GetMyWindowPlacement(HWND hwnd,MONITORINFO * hMonitorInfo);
|
||||
void FitIntoMonitorWorkArea(RECT* pRect, WININFO* pWinInfo, bool);
|
||||
WINDOWPLACEMENT WindowPlacementFromInfo(HWND hwnd, const WININFO* pWinInfo);
|
||||
void FitIntoMonitorGeometry(RECT* pRect, WININFO* pWinInfo, SCREEN_MODE mode);
|
||||
WINDOWPLACEMENT WindowPlacementFromInfo(HWND hwnd, const WININFO* pWinInfo, SCREEN_MODE mode);
|
||||
|
||||
void DialogNewWindow(HWND hwnd,bool,bool);
|
||||
void DialogFileBrowse(HWND hwnd);
|
||||
|
||||
@ -148,6 +148,7 @@ static int s_cyReBarFrame;
|
||||
static int s_cxEditFrame;
|
||||
static int s_cyEditFrame;
|
||||
static bool s_bUndoRedoScroll = false;
|
||||
static bool s_bPrevFullScreenFlag = false;
|
||||
|
||||
// for tiny expression calculation
|
||||
static double s_dExpression = 0.0;
|
||||
@ -1100,7 +1101,7 @@ void InitWindowPosition(WININFO* pWinInfo, const int flagsPos)
|
||||
RECT const rc = RectFromWinInfo(&winfo);
|
||||
GetMonitorInfoFromRect(&rc, &mi);
|
||||
WININFO wi = winfo; wi.cx = wi.cy = 16; // really small
|
||||
FitIntoMonitorWorkArea(&(mi.rcWork), &wi, false);
|
||||
FitIntoMonitorGeometry(&(mi.rcWork), &wi, SCR_NORMAL);
|
||||
winfo.x = wi.x;
|
||||
winfo.y = wi.y;
|
||||
}
|
||||
@ -2427,6 +2428,10 @@ LRESULT MsgEndSession(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (!bShutdownOK) {
|
||||
|
||||
if (s_bPrevFullScreenFlag) {
|
||||
SendWMCommand(hwnd, CMD_FULLSCRWINPOS);
|
||||
}
|
||||
|
||||
// Terminate file watching
|
||||
InstallFileWatching(NULL);
|
||||
|
||||
@ -6052,18 +6057,18 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
|
||||
case CMD_INITIALWINPOS:
|
||||
SnapToWinInfoPos(hwnd, &s_WinInfo, false);
|
||||
SnapToWinInfoPos(hwnd, &s_WinInfo, SCR_NORMAL);
|
||||
break;
|
||||
|
||||
case CMD_FULLSCRWINPOS:
|
||||
{
|
||||
WININFO const wi = GetMyWindowPlacement(Globals.hwndMain, NULL);
|
||||
SnapToWinInfoPos(hwnd, &wi, true);
|
||||
SnapToWinInfoPos(hwnd, &wi, SCR_FULL_SCREEN);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_DEFAULTWINPOS:
|
||||
SnapToWinInfoPos(hwnd, &s_DefWinInfo, false);
|
||||
SnapToWinInfoPos(hwnd, &s_DefWinInfo, SCR_NORMAL);
|
||||
break;
|
||||
|
||||
case CMD_SAVEASDEFWINPOS:
|
||||
@ -10360,21 +10365,26 @@ bool RelaunchElevated(LPWSTR lpNewCmdLnArgs)
|
||||
// SnapToWinInfoPos()
|
||||
// Aligns Notepad3 to the default window position on the current screen
|
||||
//
|
||||
void SnapToWinInfoPos(HWND hwnd, const WININFO* pWinInfo, bool bFullWorkArea)
|
||||
void SnapToWinInfoPos(HWND hwnd, const WININFO* pWinInfo, SCREEN_MODE mode)
|
||||
{
|
||||
static WINDOWPLACEMENT s_wndplPrev;
|
||||
static bool s_bPrevFullWAFlag = false;
|
||||
static bool s_bPrevShowToolbar = true;
|
||||
static bool s_bPrevShowStatusbar = true;
|
||||
static bool s_bPrevShowToolbar = false;
|
||||
static bool s_bPrevShowStatusbar = false;
|
||||
|
||||
WINDOWPLACEMENT wndpl;
|
||||
RECT rcCurrent; GetWindowRect(hwnd, &rcCurrent);
|
||||
|
||||
if (bFullWorkArea) {
|
||||
if (s_bPrevFullWAFlag) { // snap to previous rect
|
||||
if ((mode == SCR_FULL_WORKAREA) || (mode == SCR_FULL_SCREEN)) {
|
||||
if (s_bPrevFullScreenFlag) { // snap to previous rect
|
||||
Settings.ShowToolbar = s_bPrevShowToolbar;
|
||||
Settings.ShowStatusbar = s_bPrevShowStatusbar;
|
||||
//SetMenu(Globals.hwndMain, Globals.hMainMenu);
|
||||
if (Settings.AlwaysOnTop) {
|
||||
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
else {
|
||||
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
wndpl = s_wndplPrev;
|
||||
}
|
||||
else {
|
||||
@ -10383,17 +10393,26 @@ void SnapToWinInfoPos(HWND hwnd, const WININFO* pWinInfo, bool bFullWorkArea)
|
||||
s_bPrevShowStatusbar = Settings.ShowStatusbar;
|
||||
Settings.ShowToolbar = Settings.ShowStatusbar = false;
|
||||
//SetMenu(Globals.hwndMain, NULL);
|
||||
wndpl = WindowPlacementFromInfo(hwnd, NULL);
|
||||
wndpl = WindowPlacementFromInfo(hwnd, NULL, mode);
|
||||
if (mode == SCR_FULL_SCREEN) {
|
||||
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
}
|
||||
s_bPrevFullWAFlag = !s_bPrevFullWAFlag;
|
||||
s_bPrevFullScreenFlag = !s_bPrevFullScreenFlag;
|
||||
}
|
||||
else {
|
||||
wndpl = WindowPlacementFromInfo(hwnd, pWinInfo);
|
||||
if (s_bPrevFullWAFlag) {
|
||||
if (Settings.AlwaysOnTop) {
|
||||
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
else {
|
||||
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
wndpl = WindowPlacementFromInfo(hwnd, pWinInfo, SCR_NORMAL);
|
||||
if (s_bPrevFullScreenFlag) {
|
||||
Settings.ShowToolbar = s_bPrevShowToolbar;
|
||||
Settings.ShowStatusbar = s_bPrevShowStatusbar;
|
||||
}
|
||||
s_bPrevFullWAFlag = false;
|
||||
s_bPrevFullScreenFlag = false;
|
||||
}
|
||||
|
||||
if (GetDoAnimateMinimize()) {
|
||||
|
||||
@ -125,7 +125,7 @@ bool ActivatePrevInst();
|
||||
bool RelaunchMultiInst();
|
||||
bool RelaunchElevated(LPWSTR lpNewCmdLnArgs);
|
||||
bool DoElevatedRelaunch(EditFileIOStatus* pFioStatus);
|
||||
void SnapToWinInfoPos(HWND hwnd, const WININFO* pWinInfo, bool bFullWorkArea);
|
||||
void SnapToWinInfoPos(HWND hwnd, const WININFO* pWinInfo, SCREEN_MODE mode);
|
||||
void ShowNotifyIcon(HWND hwnd, bool bAdd);
|
||||
void SetNotifyIconTitle(HWND hwnd);
|
||||
void InstallFileWatching(LPCWSTR lpszFile);
|
||||
|
||||
@ -86,6 +86,8 @@ typedef struct _wi
|
||||
|
||||
#define INIT_WININFO { CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, false, 100 }
|
||||
|
||||
typedef enum { SCR_NORMAL = 0, SCR_FULL_WORKAREA = 1, SCR_FULL_SCREEN = 2 } SCREEN_MODE;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#define SAPPNAME "Notepad3"
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 19
|
||||
#define VERSION_REV 912
|
||||
#define VERSION_BUILD 2631
|
||||
#define VERSION_REV 913
|
||||
#define VERSION_BUILD 2632
|
||||
#define SCINTILLA_VER 420
|
||||
#define ONIGURUMA_REGEX_VER 6.9.3
|
||||
#define UCHARDET_VER 2018.09.27
|
||||
|
||||
Loading…
Reference in New Issue
Block a user