//returns -1 if code not handled, otherwise returns new insertion pos UInt32 TextInputJournal::ResolveControlCode(UInt8 controlCode, UInt32 insertPos) { if (IsFull()) return -1; UInt32 newPos = insertPos; switch (controlCode) { case DIK_RETURN: //line break newPos = InsertText(insertPos, kTagStrings[kHTMLTag_BR].c_str()); break; case DIK_UP: //move to end of previous line newPos = FindLineStart(insertPos); if (newPos > GetMinPos()) newPos = SeekPosition(newPos, true, true); break; case DIK_DOWN: //move to start of next line newPos = FindLineEnd(insertPos); if (newPos <= GetMaxPos()) newPos = SeekPosition(newPos, false, true); break; case DIK_C: //align center newPos = SetLineStartingTag(insertPos, kHTMLTag_DIV_Center); break; case DIK_L: //align left newPos = SetLineStartingTag(insertPos, kHTMLTag_DIV_Left); break; case DIK_R: //align right newPos = SetLineStartingTag(insertPos, kHTMLTag_DIV_Right); break; case DIK_1: case DIK_2: case DIK_3: case DIK_4: case DIK_5: //Change font { char fontNum = controlCode - DIK_1 + '1'; m_inputText[12] = fontNum; break; } default: newPos = -1; } return newPos; }
HRESULT FMPlayerDShow::Start() { HRESULT hr = E_FAIL; CComQIPtr<IFilterGraph> pFilterGraph = m_FilterGraph; if (pFilterGraph == NULL) return E_FAIL; m_MediaEvent = pFilterGraph; m_pBV = pFilterGraph; BOOL bIsFullScreen = IsFullScreen(); SetParentWnd(m_hWndParent); if (bIsFullScreen) SetFullScreen(TRUE); if (m_MediaControl != NULL) { hr = SeekPosition(m_Offset); m_Offset = 0; } return hr; }
UInt32 TextInputMenu::DeleteText(UInt32 startPos, bool bBackwards, bool bDeleteWord) { UInt32 delPos = SeekPosition(startPos, bBackwards, bDeleteWord); if (bBackwards) { m_inputText.erase(delPos, startPos - delPos); return delPos; } else { m_inputText.erase(startPos, delPos - startPos); return startPos; } }
void FMediaPlayerVLC_Ex::OnAxWndTimer(UINT timerID) { HRESULT hr = E_FAIL; if (timerID == 0) { if (m_pInput) { long lState = 0; hr = m_pInput->get_state(&lState); VLCStates newState = (VLCStates)lState; VLCStates prevState = m_State; if (prevState != newState) { switch(newState) { case vlcStopped: if (prevState == vlcPlaying) m_pNotify->NotifyPlayer(PluginPlaybackFinished, S_OK); else if (prevState == vlcLoading) m_pNotify->NotifyPlayer(PluginMediaReady, E_FAIL); break; case vlcLoading: break; case vlcBuffering: m_pNotify->NotifyPlayer(PluginMediaBuffering, S_OK); break; case vlcPlaying: if (m_GoToOffset > 0) { SeekPosition(m_GoToOffset); m_GoToOffset = 0; } _DBGAlert("Media ready\n"); m_pNotify->NotifyPlayer(PluginMediaReady, S_OK); break; case vlcPaused: break; } } if (newState < 5) m_State = newState; } } }