Ticket #9: tooltip.patch
File tooltip.patch, 6.3 KB (added by , 17 years ago) |
---|
-
BOINCTaskBar.cpp
88 88 m_bTaskbarInitiatedShutdown = false; 89 89 90 90 m_dtLastHoverDetected = wxDateTime((time_t)0); 91 m_dtLastBalloonDisplayed = wxDateTime((time_t)0);92 91 93 92 m_bMouseButtonPressed = false; 94 93 … … 303 302 304 303 305 304 void CTaskBarIcon::OnMouseMove(wxTaskBarIconEvent& WXUNUSED(event)) { 306 wxTimeSpan ts(wxDateTime::Now() - m_dtLastHoverDetected);307 if (ts.GetSeconds() >= 10) {308 m_dtLastHoverDetected = wxDateTime::Now();309 }310 305 311 306 wxTimeSpan tsLastHover(wxDateTime::Now() - m_dtLastHoverDetected); 312 wxTimeSpan tsLastBalloon(wxDateTime::Now() - m_dtLastBalloonDisplayed);313 if ((tsLastHover.GetSeconds() >= 2) && (tsLastBalloon.GetSeconds() >= 10)) {314 m_dtLastBalloonDisplayed = wxDateTime::Now();315 307 308 if (tsLastHover.GetSeconds() >= 2) { 309 m_dtLastHoverDetected = wxDateTime::Now(); 310 316 311 CMainDocument* pDoc = wxGetApp().GetDocument(); 317 312 CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced(); 318 313 wxString strTitle = wxEmptyString; … … 340 335 341 336 if (pDoc->IsConnected()) { 342 337 pDoc->GetConnectedComputerName(strMachineName); 343 if ( pDoc->IsComputerNameLocal(strMachineName)) {344 str MachineName = wxT("localhost");338 if (!pDoc->IsComputerNameLocal(strMachineName)) { 339 strTitle = strTitle + wxT(" - (") + strMachineName + wxT(")"); 345 340 } 346 strTitle = strTitle + wxT(" - (") + strMachineName + wxT(")");347 341 342 strMessage += strTitle; 343 348 344 pDoc->GetCoreClientStatus(status); 349 345 if (status.task_suspend_reason && !(status.task_suspend_reason & SUSPEND_REASON_CPU_USAGE_LIMIT)) { 350 346 // 1st %s is the previous instance of the message 351 347 // 2nd %s is the project name 352 348 // i.e. 'BOINC', 'GridRepublic' 353 349 strBuffer.Printf( 354 _(" %s is currently suspended...\n"),350 _("\n%s is currently suspended..."), 355 351 pSkinAdvanced->GetProjectName().c_str() 356 352 ); 357 353 iconIcon = m_iconTaskBarSnooze; … … 363 359 // 2nd %s is the project name 364 360 // i.e. 'BOINC', 'GridRepublic' 365 361 strBuffer.Printf( 366 _(" %s networking is currently suspended...\n"),362 _("\n%s networking is currently suspended..."), 367 363 pSkinAdvanced->GetProjectName().c_str() 368 364 ); 369 365 strMessage += strBuffer; 370 366 } 371 367 372 if (strMessage.Length() > 0) {373 strMessage += wxT("\n");374 }368 //if (strMessage.Length() > 0) { 369 // strMessage += wxT("\n"); 370 //} 375 371 376 372 iResultCount = pDoc->GetWorkCount(); 377 373 for (iIndex = 0; iIndex < iResultCount; iIndex++) { … … 393 389 fProgress = floor(result->fraction_done*10000)/100; 394 390 } 395 391 396 strBuffer.Printf(wxT(" %s: %.2f%%\n"), strProjectName.c_str(), fProgress );392 strBuffer.Printf(wxT("\n%s: %.2f%%"), strProjectName.c_str(), fProgress ); 397 393 strMessage += strBuffer; 398 394 } 399 395 } else if (pDoc->IsReconnecting()) { … … 403 399 // 3rd %s is the project name 404 400 // i.e. 'BOINC', 'GridRepublic' 405 401 strBuffer.Printf( 406 _(" %s is currently reconnecting to a %s client...\n"),402 _("\n%s is currently reconnecting to a %s client..."), 407 403 pSkinAdvanced->GetApplicationName().c_str(), 408 404 pSkinAdvanced->GetProjectName().c_str() 409 405 ); … … 415 411 // 3rd %s is the project name 416 412 // i.e. 'BOINC', 'GridRepublic' 417 413 strBuffer.Printf( 418 _(" %s is not currently connected to a %s client...\n"),414 _("\n%s is not currently connected to a %s client..."), 419 415 pSkinAdvanced->GetApplicationName().c_str(), 420 416 pSkinAdvanced->GetProjectName().c_str() 421 417 ); … … 423 419 strMessage += strBuffer; 424 420 } 425 421 426 Set Balloon(iconIcon, strTitle,strMessage);422 SetTooltip(strMessage); 427 423 } 428 424 } 429 425 … … 480 476 SetIcon(m_iconTaskBarNormal, wxT("")); 481 477 #endif 482 478 483 m_dtLastBalloonDisplayed = wxDateTime::Now();484 479 } 485 480 486 481 -
BOINCTaskBar.h
81 81 82 82 private: 83 83 wxDateTime m_dtLastHoverDetected; 84 wxDateTime m_dtLastBalloonDisplayed;85 84 86 85 wxTimer* m_pRefreshTimer; 87 86 -
msw/taskbarex.cpp
186 186 } 187 187 } 188 188 189 bool wxTaskBarIconEx::SetTooltip(const wxString tip) 190 { 191 if (!IsOK()) 192 return false; 193 194 memset(¬ifyData, 0, sizeof(notifyData)); 195 notifyData.cbSize = sizeof(notifyData); 196 notifyData.hWnd = (HWND) m_hWnd; 197 notifyData.uID = 99; 198 notifyData.uCallbackMessage = sm_taskbarMsg; 199 notifyData.uFlags = NIF_TIP; 200 notifyData.uVersion = NOTIFYICON_VERSION; 201 202 lstrcpyn(notifyData.szTip, WXSTRINGCAST tip, sizeof(notifyData.szTip)); 203 204 if (m_iconAdded) 205 return (Shell_NotifyIcon(NIM_MODIFY, & notifyData) != 0); 206 else 207 { 208 m_iconAdded = (Shell_NotifyIcon(NIM_ADD, & notifyData) != 0); 209 if (IsBalloonsSupported()) 210 Shell_NotifyIcon(NIM_SETVERSION, ¬ifyData); 211 return m_iconAdded; 212 } 213 } 214 215 189 216 bool wxTaskBarIconEx::RemoveIcon(void) 190 217 { 191 218 if (!m_iconAdded) -
msw/taskbarex.h
57 57 unsigned int iconballoon = NIIF_INFO 58 58 ); 59 59 60 bool SetTooltip(const wxString tip); 61 60 62 bool RemoveIcon(); 61 63 62 64 bool PopupMenu(wxMenu *menu); //, int x, int y);