diff --git a/README.md b/README.md index 13b60053..8e06eb6c 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ Basic on-the-fly image processing is provided - allowing adjusting typical param * No change: * F12: toggles span all monitors, or not. * SHF+F12: toggles always on top. + * New: Override via commandline option `/top` to enable always on top. Use `/top 0` or `/top false` to disable. * CTRL+F12: toggle to next monitor. Now if there are more than 2 monitors (assuming horizontal row), this hotkey toggles in this cycle: monitor #1, #2, ... #last, all but last `[XX ]`, all but 1st `[ XX]`, and back. * F1 with CTRL, SHF or ALT combos can now be used as hotkeys for other commands; only F1 shows the help info. diff --git a/src/JPEGView/JPEGView.cpp b/src/JPEGView/JPEGView.cpp index 146ca23e..08d9766d 100644 --- a/src/JPEGView/JPEGView.cpp +++ b/src/JPEGView/JPEGView.cpp @@ -69,6 +69,20 @@ static CString ParseCommandLineForStartupFile(LPCTSTR sCommandLine) { return sStartupFile; } +static void ParseCommandLineForAlwaysOnTop(LPCTSTR sCommandLine) { + LPCTSTR sTop = Helpers::stristr(sCommandLine, _T("/top")); + if (sTop == NULL) { + return; + } + CString strState(sTop + _tcslen(_T("/top"))); + strState.Trim(); + bool bAlwaysOnTop = true; + if ( (strState.GetLength() > 0) + && ((strState.CompareNoCase(_T("false")) == 0) || (strState.Compare(_T("0")) == 0)) ) + bAlwaysOnTop = false; + CSettingsProvider::This().SetWindowAlwaysOnTopOnStartup(bAlwaysOnTop); +} + static double ParseCommandLineForAutostart(LPCTSTR sCommandLine) { LPCTSTR sAutoStart = Helpers::stristr(sCommandLine, _T("/slideshow")); if (sAutoStart == NULL) { @@ -205,6 +219,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lp CString sStartupFile = ParseCommandLineForStartupFile(lpstrCmdLine); //Allow selection of image later, then auto-start slideshow + ParseCommandLineForAlwaysOnTop(lpstrCmdLine); double dAutostartSlideShow = ParseCommandLineForAutostart(lpstrCmdLine); bool bForceFullScreen = ParseCommandLineForFullScreen(lpstrCmdLine); bool bAutoExit = ParseCommandLineForAutoExit(lpstrCmdLine); diff --git a/src/JPEGView/MainDlg.cpp b/src/JPEGView/MainDlg.cpp index e9e6d084..6eb20fdc 100644 --- a/src/JPEGView/MainDlg.cpp +++ b/src/JPEGView/MainDlg.cpp @@ -2414,6 +2414,7 @@ void CMainDlg::ExecuteCommand(int nCommand) { break; case IDM_ALWAYS_ON_TOP: ToggleAlwaysOnTop(); + SetToast(m_bAlwaysOnTop? _T("Always on Top"): _T("Not on Top")); break; case IDM_FIT_WINDOW_TO_IMAGE: diff --git a/src/JPEGView/SettingsProvider.h b/src/JPEGView/SettingsProvider.h index a467d6c6..2e2eba04 100644 --- a/src/JPEGView/SettingsProvider.h +++ b/src/JPEGView/SettingsProvider.h @@ -133,6 +133,7 @@ class CSettingsProvider LPCTSTR CustomIniEditor() { return m_sIniEditor; } LPCTSTR GPSMapProvider() { return m_sGPSMapProvider; } bool WindowAlwaysOnTopOnStartup() { return m_bWindowAlwaysOnTopOnStartup; } + void SetWindowAlwaysOnTopOnStartup(bool bAlwaysOnTop) { m_bWindowAlwaysOnTopOnStartup = bAlwaysOnTop; } static double ParseTimeInterval(CString &strInterval); // Returns if a user INI file exists