bool CKaraokeWindowBackground::OnMessage(CGUIMessage & message) { CSingleLock lock (m_CritSectionShared); // Forward visualisation control messages switch ( message.GetMessage() ) { case GUI_MSG_PLAYBACK_STARTED: if ( m_currentMode == BACKGROUND_VISUALISATION ) return m_VisControl->OnMessage(message); break; case GUI_MSG_GET_VISUALISATION: if ( m_currentMode == BACKGROUND_VISUALISATION ) message.SetPointer( m_VisControl->GetVisualisation() ); break; case GUI_MSG_VISUALISATION_ACTION: if ( m_currentMode == BACKGROUND_VISUALISATION ) return m_VisControl->OnMessage(message); break; } return false; }
bool CGUIWindowBoxeeMediaMain::OnMessage(CGUIMessage& message) { switch ( message.GetMessage() ) { case GUI_MSG_WINDOW_DEINIT: Cleanup(); CGUIWindow::OnMessage(message); return true; case MSG_ITEM_LOADED: { CFileItem *pItem = (CFileItem *)message.GetPointer(); message.SetPointer(NULL); if (!pItem) return true; UpdateItemInList(pItem, m_listMediaItems); UpdateItemInList(pItem, m_listMediaItemsSmall); UpdateItemInList(pItem, m_listApps); UpdateItemInList(pItem, m_listAppsSmall); delete pItem; } return true; case GUI_MSG_CLICKED: { CGUIWindow::OnMessage(message); int iControl = message.GetSenderId(); int iAction = message.GetParam1(); if (iControl == TAB_BUTTON_BROWSE) OnMoreMedia(); else if (iControl == TAB_BUTTON_APPS) OnMoreApps(); else OnClick(iControl, iAction); return true; } break; case GUI_MSG_REFRESH_APPS: { LoadMediaItems(); return true; } break; default: break; } return CGUIWindow::OnMessage(message); }
bool CGUIVisualisationControl::OnMessage(CGUIMessage &message) { if (message.GetMessage() == GUI_MSG_GET_VISUALISATION) { message.SetPointer(GetVisualisation()); return true; } else if (message.GetMessage() == GUI_MSG_VISUALISATION_ACTION) { CAction action; action.id = message.GetParam1(); return OnAction(action); } else if (message.GetMessage() == GUI_MSG_PLAYBACK_STARTED) { if (IsVisible() && UpdateTrack()) return true; } return CGUIControl::OnMessage(message); }
bool CGUIVisualisationControl::OnMessage(CGUIMessage &message) { switch (message.GetMessage()) { case GUI_MSG_GET_VISUALISATION: message.SetPointer(m_addon.get()); return m_addon != NULL; case GUI_MSG_VISUALISATION_RELOAD: FreeResources(true); return true; case GUI_MSG_PLAYBACK_STARTED: if (m_addon) { m_addon->UpdateTrack(); return true; } break; } return CGUIRenderingControl::OnMessage(message); }
bool CGUIWindow::OnMessage(CGUIMessage& message) { switch ( message.GetMessage() ) { case GUI_MSG_WINDOW_LOAD: { Initialize(); return true; } break; case GUI_MSG_WINDOW_INIT: { CLog::Log(LOGDEBUG, "------ Window Init (%s) ------", GetProperty("xmlfile").c_str()); if (m_dynamicResourceAlloc || !m_bAllocated) AllocResources(false); OnInitWindow(); return true; } break; case GUI_MSG_WINDOW_DEINIT: { CLog::Log(LOGDEBUG, "------ Window Deinit (%s) ------", GetProperty("xmlfile").c_str()); OnDeinitWindow(message.GetParam1()); // now free the window if (m_dynamicResourceAlloc) FreeResources(); return true; } break; case GUI_MSG_UNFOCUS_ALL: { //unfocus the current focused control in this window CGUIControl *control = GetFocusedControl(); if(control) { //tell focused control that it has lost the focus CGUIMessage msgLostFocus(GUI_MSG_LOSTFOCUS, GetID(), control->GetID(), control->GetID()); control->OnMessage(msgLostFocus); CLog::Log(LOGDEBUG, "Unfocus WindowID: %i, ControlID: %i",GetID(), control->GetID()); } return true; } case GUI_MSG_FOCUSED: { // a control has been focused if (HasID(message.GetSenderId())) { m_focusedControl = message.GetControlId(); return true; } break; } case GUI_MSG_LOSTFOCUS: { // nothing to do at the window level when we lose focus return true; } case GUI_MSG_MOVE: { if (HasID(message.GetSenderId())) return OnMove(message.GetControlId(), message.GetParam1()); break; } case GUI_MSG_SETFOCUS: { // CLog::Log(LOGDEBUG,"set focus to control:%i window:%i (%i)\n", message.GetControlId(),message.GetSenderId(), GetID()); if ( message.GetControlId() ) { // first unfocus the current control CGUIControl *control = GetFocusedControl(); if (control) { CGUIMessage msgLostFocus(GUI_MSG_LOSTFOCUS, GetID(), control->GetID(), message.GetControlId()); control->OnMessage(msgLostFocus); } // get the control to focus CGUIControl* pFocusedControl = GetFirstFocusableControl(message.GetControlId()); if (!pFocusedControl) pFocusedControl = GetControl(message.GetControlId()); // and focus it if (pFocusedControl) return pFocusedControl->OnMessage(message); } return true; } break; case GUI_MSG_EXCLUSIVE_MOUSE: { m_exclusiveMouseControl = message.GetSenderId(); return true; } break; case GUI_MSG_GESTURE_NOTIFY: { CAction action(ACTION_GESTURE_NOTIFY, 0, static_cast<float>(message.GetParam1()), static_cast<float>(message.GetParam2()), 0, 0); EVENT_RESULT result = OnMouseAction(action); auto res = new int(result); message.SetPointer(static_cast<void*>(res)); return result != EVENT_RESULT_UNHANDLED; } case GUI_MSG_ADD_CONTROL: { if (message.GetPointer()) { CGUIControl *control = static_cast<CGUIControl*>(message.GetPointer()); control->AllocResources(); AddControl(control); } return true; } case GUI_MSG_REMOVE_CONTROL: { if (message.GetPointer()) { CGUIControl *control = static_cast<CGUIControl*>(message.GetPointer()); RemoveControl(control); control->FreeResources(true); delete control; } return true; } case GUI_MSG_NOTIFY_ALL: { // only process those notifications that come from this window, or those intended for every window if (HasID(message.GetSenderId()) || !message.GetSenderId()) { if (message.GetParam1() == GUI_MSG_PAGE_CHANGE || message.GetParam1() == GUI_MSG_REFRESH_THUMBS || message.GetParam1() == GUI_MSG_REFRESH_LIST || message.GetParam1() == GUI_MSG_WINDOW_RESIZE) { // alter the message accordingly, and send to all controls for (iControls it = m_children.begin(); it != m_children.end(); ++it) { CGUIControl *control = *it; CGUIMessage msg(message.GetParam1(), message.GetControlId(), control->GetID(), message.GetParam2()); control->OnMessage(msg); } } else if (message.GetParam1() == GUI_MSG_STATE_CHANGED) MarkDirtyRegion(DIRTY_STATE_CHILD); //Don't force an dirtyRect, we don't know if / what has changed. } } break; } return CGUIControlGroup::OnMessage(message); }
bool CGUIWindowVisualisation::OnMessage(CGUIMessage& message) { switch ( message.GetMessage() ) { case GUI_MSG_PLAYBACK_STARTED: { CGUIDialogBoxeeMusicCtx* pDlgInfo = (CGUIDialogBoxeeMusicCtx*)g_windowManager.GetWindow(WINDOW_DIALOG_BOXEE_MUSIC_CTX); if(!pDlgInfo->IsActive()) { CGUIVisualisationControl *pVisControl = (CGUIVisualisationControl *)GetControl(CONTROL_VIS); if (pVisControl) return pVisControl->OnMessage(message); } else { pDlgInfo->DoModal(); } } break; case GUI_MSG_GET_VISUALISATION: { // message.SetControlID(CONTROL_VIS); CGUIVisualisationControl *pVisControl = (CGUIVisualisationControl *)GetControl(CONTROL_VIS); if (pVisControl) message.SetPointer(pVisControl->GetVisualisation()); return true; } break; case GUI_MSG_VISUALISATION_ACTION: { // message.SetControlID(CONTROL_VIS); CGUIVisualisationControl *pVisControl = (CGUIVisualisationControl *)GetControl(CONTROL_VIS); if (pVisControl) return pVisControl->OnMessage(message); } break; case GUI_MSG_WINDOW_DEINIT: { g_windowManager.CloseDialogs(true); /* if (IsActive()) // save any changed settings from the OSD g_settings.Save(); // check and close any OSD windows CGUIDialogMusicOSD *pOSD = (CGUIDialogMusicOSD *)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_OSD); if (pOSD && pOSD->IsDialogRunning()) pOSD->Close(true); CGUIDialogVisualisationPresetList *pList = (CGUIDialogVisualisationPresetList *)g_windowManager.GetWindow(WINDOW_DIALOG_VIS_PRESET_LIST); if (pList && pList->IsDialogRunning()) pList->Close(true); //Boxee //Boxee uses different windows CGUIWindowMusicInfo *pOSD2 = (CGUIWindowMusicInfo *)g_windowManager.GetWindow(WINDOW_MUSIC_INFO); if (pOSD2 && pOSD2->IsDialogRunning()) pOSD2->Close(true); CGUIDialogBoxeeMusicCtx *pList2 = (CGUIDialogBoxeeMusicCtx *)g_windowManager.GetWindow(WINDOW_DIALOG_BOXEE_MUSIC_CTX); if (pList2 && pList2->IsDialogRunning()) pList2->Close(true); //end Boxee */ } break; case GUI_MSG_WINDOW_INIT: { // Switching to visualization, closes all dialogs g_windowManager.CloseDialogs(true); /* //Boxee CGUIWindowMusicInfo* pDlgInfo = (CGUIWindowMusicInfo*)g_windowManager.GetWindow(WINDOW_MUSIC_INFO); pDlgInfo->Close(); // make sure info dialog is closed //end Boxee */ // check whether we've come back here from a window during which time we've actually // stopped playing music if (message.GetParam1() == WINDOW_INVALID && !g_application.IsPlayingAudio()) { // why are we here if nothing is playing??? g_windowManager.PreviousWindow(); return true; } // hide or show the preset button(s) g_infoManager.SetShowCodec(m_bShowPreset); g_infoManager.SetShowInfo(true); // always show the info initially. CGUIWindow::OnMessage(message); if (g_infoManager.GetCurrentSongTag()) m_tag = *g_infoManager.GetCurrentSongTag(); if (g_stSettings.m_bMyMusicSongThumbInVis) { // always on m_initTimer = 0; } else { // start display init timer (fade out after 3 secs...) m_initTimer = g_advancedSettings.m_songInfoDuration * (int)g_infoManager.GetFPS(); } ShowOSD(); return true; } } return CGUIWindow::OnMessage(message); }
bool CGUIDialogBoxeeCtx::OnMessage(CGUIMessage &message) { switch (message.GetMessage()) { case GUI_MSG_ITEM_LOADED: { // New data received from the item loader, update existing item CFileItemPtr pItem ((CFileItem *)message.GetPointer()); message.SetPointer(NULL); if (pItem) { m_item = *pItem; CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), INFO_HIDDEN_LIST, 0); OnMessage(msg); CGUIMessage winmsg(GUI_MSG_LABEL_ADD, GetID(), INFO_HIDDEN_LIST, 0, 0, pItem); OnMessage(winmsg); CGUIMessage ref1(GUI_MSG_REFRESH_THUMBS, GetID(), IMG1); OnMessage(ref1); CGUIMessage ref2(GUI_MSG_REFRESH_THUMBS, GetID(), IMG2); OnMessage(ref2); CGUIMessage ref3(GUI_MSG_REFRESH_THUMBS, GetID(), IMG3); OnMessage(ref3); CGUIMessage ref4(GUI_MSG_REFRESH_THUMBS, GetID(), IMG4); OnMessage(ref4); } return true; } case GUI_MSG_CLICKED: { unsigned int iControl = message.GetSenderId(); if (iControl == BTN_MORE_INFO) { OnMoreInfo(); return true; } else if (iControl == BTN_RATE) { bool bLike; if (CGUIDialogBoxeeRate::ShowAndGetInput(bLike)) { BoxeeUtils::Rate(&m_item, bLike); g_application.m_guiDialogKaiToast.QueueNotification(CGUIDialogKaiToast::ICON_STAR, "", g_localizeStrings.Get(51034), 5000 , KAI_YELLOW_COLOR, KAI_GREY_COLOR); } } else if (iControl == BTN_SHARE) { CGUIDialogBoxeeShare *pShare = (CGUIDialogBoxeeShare *)g_windowManager.GetWindow(WINDOW_DIALOG_BOXEE_SHARE); if (pShare) { pShare->SetItem(&m_item); pShare->DoModal(); } else { CLog::Log(LOGERROR,"CGUIDialogBoxeeCtx::OnMessage - GUI_MSG_CLICKED - BTN_SHARE - FAILED to get WINDOW_DIALOG_BOXEE_SHARE (share)"); } } else if (iControl == BTN_PRESET) { if (m_item.GetPropertyBOOL("IsPreset")) { CGUIDialogYesNo* dlgYesNo = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (dlgYesNo) { dlgYesNo->SetHeading(51020); dlgYesNo->SetLine(0, 51021); dlgYesNo->SetLine(1, m_item.GetLabel() + "?"); dlgYesNo->SetLine(2, ""); dlgYesNo->DoModal(); if (dlgYesNo->IsConfirmed()) { g_settings.DeleteSource(GetItemShareType(), m_item.GetProperty("ShareName"), m_item.m_strPath); CGUIWindow *pWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow()); if (pWindow) { CGUIMessage msg(GUI_MSG_REFRESH_APPS, 0, 0); pWindow->OnMessage(msg); } } } } else { CMediaSource newShare; newShare.strPath = m_item.m_strPath; newShare.strName = m_item.GetLabel(); if (m_item.HasProperty("OriginalThumb") && !m_item.GetProperty("OriginalThumb").IsEmpty()) newShare.m_strThumbnailImage = m_item.GetProperty("OriginalThumb"); else newShare.m_strThumbnailImage = m_item.GetThumbnailImage(); newShare.vecPaths.push_back(m_item.m_strPath); g_settings.AddShare(GetItemShareType(), newShare); } Close(); return true; } else if (iControl == BTN_QUALITY) { return HandleQualityList(); } } break; case GUI_MSG_WINDOW_DEINIT: case GUI_MSG_VISUALISATION_UNLOADING: { } break; case GUI_MSG_VISUALISATION_LOADED: { } } return CGUIDialog::OnMessage(message); }