Ejemplo n.º 1
0
void COsmo4AppView::MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct)
{
	GF_Event e;
	switch (aOperationId) {
/*
    TRequestStatus status;
	case ERemConCoreApiPausePlayFunction:
	case ERemConCoreApiStop:
	case ERemConCoreApiRewind:
	case ERemConCoreApiForward:
	case ERemConCoreApiFastForward:
	case ERemConCoreApiBackward:
		switch (aButtonAct) {
		case ERemConCoreApiButtonPress:
			break;
		case ERemConCoreApiButtonRelease:
			break;
		case ERemConCoreApiButtonClick:
			break;
		default:
			break;
		}
*/
	case ERemConCoreApiVolumeUp:
	case ERemConCoreApiVolumeDown:
#ifndef GPAC_GUI_ONLY
		e.key.hw_code = 0;
		e.key.flags = 0;
		e.key.key_code = (aOperationId==ERemConCoreApiVolumeUp) ? GF_KEY_VOLUMEUP : GF_KEY_VOLUMEDOWN;
		switch (aButtonAct) {
		case ERemConCoreApiButtonPress:
			e.type = GF_EVENT_KEYDOWN;
			gf_term_user_event(m_term, &e);
			break;
		case ERemConCoreApiButtonRelease:
			e.type = GF_EVENT_KEYUP;
			gf_term_user_event(m_term, &e);
			break;
		default:
			e.type = GF_EVENT_KEYDOWN;
			gf_term_user_event(m_term, &e);
			e.type = GF_EVENT_KEYUP;
			gf_term_user_event(m_term, &e);
			break;
		}
#endif
		break;
	default:
		break;
	}
}
Ejemplo n.º 2
0
TKeyResponse COsmo4AppView::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
	GF_Event evt;
	u32 ret;

	evt.key.hw_code = aKeyEvent.iScanCode;
	evt.key.flags = 0;
	switch (aType) {
	case EEventKeyUp:
		evt.type = GF_EVENT_KEYUP;
		break;
	case EEventKeyDown:
	case EEventKey:
		evt.type = GF_EVENT_KEYDOWN;
		break;
	default:
		return EKeyWasNotConsumed;
	}

	switch (aKeyEvent.iCode) {
	case EKeyLeftArrow: evt.key.key_code = GF_KEY_LEFT; break;
	case EKeyRightArrow: evt.key.key_code = GF_KEY_RIGHT; break;
	case EKeyUpArrow: evt.key.key_code = GF_KEY_UP; break;
	case EKeyDownArrow: evt.key.key_code = GF_KEY_DOWN; break;
	case EKeyIncVolume: evt.key.key_code = GF_KEY_VOLUMEUP; break;
	case EKeyDecVolume: evt.key.key_code = GF_KEY_VOLUMEDOWN; break;
	default:
		switch (aKeyEvent.iScanCode) {
		case EStdKeyIncVolume: evt.key.key_code = GF_KEY_VOLUMEUP; break;
		case EStdKeyDecVolume: evt.key.key_code = GF_KEY_VOLUMEDOWN; break;
		default:
			return EKeyWasNotConsumed;
		}
	}
#ifndef GPAC_GUI_ONLY
	ret = gf_term_user_event(m_term, &evt);
	/*generate a key up*/
	if (aType==EEventKey) {
		evt.type = GF_EVENT_KEYUP;
		ret += gf_term_user_event(m_term, &evt);
	}
#else
	ret = 0;
#endif
	return ret ? EKeyWasConsumed : EKeyWasNotConsumed;
}
Ejemplo n.º 3
0
//-----------------------------------------------------
void CNativeWrapper::onMouseMove(float x, float y) {
	if (!m_term)
		return;
	GF_Event evt;
	evt.type = GF_EVENT_MOUSEMOVE;
	evt.mouse.button = GF_MOUSE_LEFT;
	evt.mouse.x = x;
	evt.mouse.y = y;

	int ret = gf_term_user_event(m_term, &evt);
}
Ejemplo n.º 4
0
     /**
      * x: yaw (azimuth - rotation around the -Z axis) range: [-PI, PI]
      * y: pitch (rotation around the -X axis) range: [-PI/2, PI/2]
      * z: roll (rotation around the Y axis) range: [-PI, PI]
      */
void CNativeWrapper::onOrientationChange(float x, float y, float z) {
	if (!m_term)
		return;
	GF_Event evt;
	evt.type = GF_EVENT_SENSOR_ORIENTATION;
	evt.sensor.x = x;
	evt.sensor.y = y;
	evt.sensor.z = z;
	evt.sensor.w = 0;

	int ret = gf_term_user_event(m_term, &evt);
}
Ejemplo n.º 5
0
//-----------------------------------------------------
void CNativeWrapper::onKeyPress(int keycode, int rawkeycode, int up, int flag, int unicode) {
	if (!m_term)
		return;
	debug_log("onKeyPress start");
	GF_Event evt;
	memset(&evt, 0, sizeof(GF_Event));
	if (up == 0) evt.type = GF_EVENT_KEYUP;
	else evt.type = GF_EVENT_KEYDOWN;

	evt.key.flags = 0;
	evt.key.hw_code = rawkeycode;

	translate_key(keycode, &evt.key);
	//evt.key.key_code = GF_KEY_A;
	int ret = gf_term_user_event(m_term, &evt);

	if (evt.type == GF_EVENT_KEYUP && unicode) {
		memset(&evt, 0, sizeof(GF_Event));
		evt.type = GF_EVENT_TEXTINPUT;
		evt.character.unicode_char = unicode;
		ret = gf_term_user_event(m_term, &evt);
	}
}
Ejemplo n.º 6
0
//-----------------------------------------------------
void CNativeWrapper::onMouseUp(float x, float y) {
	if (!m_term)
		return;
	debug_log("onMouseUp start");
	//char msg[100];
	//sprintf(msg, "onMouseUp x=%f, y=%f", x, y );
	//debug_log(msg);

	GF_Event evt;
	evt.type = GF_EVENT_MOUSEUP;
	evt.mouse.button = GF_MOUSE_LEFT;
	evt.mouse.x = x;
	evt.mouse.y = y;

	int ret = gf_term_user_event(m_term, &evt);
	debug_log("onMouseUp end");
}
Ejemplo n.º 7
0
Bool GPAC_EventProc(void *ptr, GF_Event *evt)
{
	switch (evt->type) {
	case GF_EVENT_DURATION:
		Duration = (u32) (evt->duration.duration*1000);
		CanSeek = evt->duration.can_seek;
		break;
	case GF_EVENT_MESSAGE:
	{
		if (!evt->message.message) return 0;
		GF_LOG(GF_LOG_ERROR, GF_LOG_CONSOLE, ("%s: %s\n", evt->message.message, gf_error_to_string(evt->message.error)));
		//set_status((char *) evt->message.message);
	}
		break;
	case GF_EVENT_PROGRESS:
	{
		char *szTitle = "";
		if (evt->progress.progress_type==0) szTitle = "Buffer ";
		else if (evt->progress.progress_type==1) szTitle = "Download ";
		else if (evt->progress.progress_type==2) szTitle = "Import ";
		cbk_on_progress(szTitle, evt->progress.done, evt->progress.total);
	}
		break;

	case GF_EVENT_SIZE:
		break;
	case GF_EVENT_RESOLUTION:
		recompute_res(evt->size.width, evt->size.height);
		do_layout(1);
		break;

	case GF_EVENT_SCENE_SIZE:
		do_layout(1);
		break;
	case GF_EVENT_DBLCLICK:
		set_full_screen();
		return 0;
	case GF_EVENT_CONNECT:
		if (evt->connect.is_connected) {
			is_connected = 1;
			if (!backlight_off) set_backlight_state(1);
			refresh_recent_files();
			navigation_on = (gf_term_get_option(term, GF_OPT_NAVIGATION)==GF_NAVIGATE_NONE) ? 0 : 1;
		} else {
			navigation_on = 0;
			is_connected = 0;
			Duration = 0;
		}
		break;
	case GF_EVENT_EOS:
		if (Duration>2000)
			gf_term_play_from_time(term, 0, 0);
		break;
	case GF_EVENT_QUIT:
		PostMessage(g_hwnd, WM_DESTROY, 0, 0);
		break;
	case GF_EVENT_KEYDOWN:
		switch (evt->key.key_code) {
		case GF_KEY_ENTER:
			if (full_screen) set_full_screen();
			break;
		case GF_KEY_1:
			ctrl_mod_down = !ctrl_mod_down;
			evt->key.key_code = GF_KEY_CONTROL;
			evt->type = ctrl_mod_down ? GF_EVENT_KEYDOWN : GF_EVENT_KEYUP;
			gf_term_user_event(term, evt);
			break;
		case GF_KEY_MEDIAPREVIOUSTRACK:
			playlist_act = 2;
			break;
		case GF_KEY_MEDIANEXTTRACK:
			playlist_act = 1;
			break;
		}
		break;
	case GF_EVENT_NAVIGATE:
		if (gf_term_is_supported_url(term, evt->navigate.to_url, 1, 1)) {
			gf_term_navigate_to(term, evt->navigate.to_url);
			return 1;
		} else {
#ifdef _WIN32_WCE
			u16 dst[1024];
#endif
			SHELLEXECUTEINFO info;

/*
			if (full_screen) gf_term_set_option(term, GF_OPT_FULLSCREEN, 0);
			full_screen = 0;
*/
			memset(&info, 0, sizeof(SHELLEXECUTEINFO));
			info.cbSize = sizeof(SHELLEXECUTEINFO);
			info.lpVerb = _T("open");
			info.fMask = SEE_MASK_NOCLOSEPROCESS;
			info.lpFile = _T("iexplore");
#ifdef _WIN32_WCE
			CE_CharToWide((char *) evt->navigate.to_url, dst);
			info.lpParameters = (LPCTSTR) dst;
#else
			info.lpParameters = evt->navigate.to_url;
#endif
			info.nShow = SW_SHOWNORMAL;
			ShellExecuteEx(&info);
		}
		return 1;
	}
	return 0;
}