Patch level : 12.0 644

Files correlati     : ba7.exe
Commento            :

Aggiunta funzione per rivelvare se la taskbar è visibile
This commit is contained in:
AlexBonazzi 2018-11-26 01:53:27 +01:00
parent 1ba75cc8f2
commit ffe1040fe5
3 changed files with 63 additions and 1 deletions

View File

@ -1085,7 +1085,7 @@ bool Win32ProgressIndicator::SetProgress(long nCurrent, long nTotal)
{
const int nSpeed = nCurrent / nSec > 0 ? nCurrent / nSec : 1;
const int nRemaining = nTotal - nCurrent;
const int remainingTime = nRemaining / nSpeed;
const int remainingTime = nSpeed > 0 ? nRemaining / nSpeed : 0;
int s = nSec;
const int h = s / 3600; s %= 3600;
const int m = s / 60; s %= 60;
@ -1243,3 +1243,23 @@ void OsWin32_ProgressSetText(WXHWND prog, const char* msg)
pd->SetText(msg);
}
bool OsWin32_IsdTaskbarVisible()
{
HWND hTaskbarWnd = FindWindow("Shell_TrayWnd", NULL);
HMONITOR hMonitor = MonitorFromWindow(hTaskbarWnd, MONITOR_DEFAULTTONEAREST);
MONITORINFO info = { sizeof(MONITORINFO) };
if (GetMonitorInfo(hMonitor, &info))
{
RECT rect;
GetWindowRect(hTaskbarWnd, &rect);
if ((rect.top >= info.rcMonitor.bottom - 4) ||
(rect.right <= 2) ||
(rect.bottom <= 4) ||
(rect.left >= info.rcMonitor.right - 2))
return false;
}
return (IsWindowVisible(hTaskbarWnd));
}

View File

@ -35,6 +35,8 @@ void OsWin32_ProgressDestroy(WXHWND hProgDlg);
bool OsWin32_ProgressSetStatus(WXHWND hProgDlg, long nCurrent, long nTotal);
void OsWin32_ProgressSetText(WXHWND hProgDlg, const char* msg);
bool OsWin32_IsdTaskbarVisible();
//#define SPEECH_API 1
#ifdef SPEECH_API
bool OsWin32_InitializeSpeech();

View File

@ -3179,6 +3179,18 @@ SLIST_ELT xvt_slist_get_next(SLIST list, SLIST_ELT item)
return (SLIST_ELT)(list != NULL && item != NULL ? item->next : NULL);
}
SLIST_ELT xvt_slist_find_str(SLIST list, const char* str) // Cerca una stringa all'interno di una SLIST
{
SLIST_ELT e = NULL;
for (e = xvt_slist_get_first(list); e; e = xvt_slist_get_next(list, e))
{
const char* val = xvt_slist_get(list, e, NULL);
if (xvt_str_compare_ignoring_case(str, val) == 0)
break;
}
return e;
}
///////////////////////////////////////////////////////////
// XVT Strings???
///////////////////////////////////////////////////////////
@ -3911,6 +3923,25 @@ BOOLEAN xvt_fsys_rename_file(const char *src_pathname, const char *dst_pathname)
return wxRenameFile(src_pathname, dst_pathname);
}
BOOLEAN xvt_fsys_fupdate(const char* src, const char* dst) // Aggiorna il file dst se più vecchio di src
{
bool ok = false;
if (xvt_fsys_file_exists(src))
{
const long tsrc = xvt_fsys_file_attr(src, XVT_FILE_ATTR_MTIME);
if (tsrc > 0)
{
long tdst = 0;
if (xvt_fsys_file_exists(dst))
tdst = xvt_fsys_file_attr(dst, XVT_FILE_ATTR_MTIME);
if (tsrc > tdst)
ok = xvt_fsys_fcopy(src, dst) != 0;
}
}
return ok;
}
///////////////////////////////////////////////////////////
// Timers
///////////////////////////////////////////////////////////
@ -4559,6 +4590,15 @@ void xvt_win_trap_pointer(WINDOW win)
_mouse_trapper = &w;
}
BOOLEAN xvt_win_is_taskbar_visible()
{
#ifdef __WXMSW__
return OsWin32_IsdTaskbarVisible();
#else
return OsLinux_IsdTaskbarVisible();
#endif
}
///////////////////////////////////////////////////////////
// Status bar
///////////////////////////////////////////////////////////