Esempio n. 1
0
mvp_widget_t*
mvpw_create(mvp_widget_t *parent,
	    GR_COORD x, GR_COORD y,
	    unsigned int width, unsigned int height,
	    GR_COLOR bg, GR_COLOR border_color, int border_size)
{
	mvp_widget_t *widget;
	GR_WINDOW_ID wid, pwid;

	if (parent)
		pwid = parent->wid;
	else
		pwid = GR_ROOT_WINDOW_ID;

	wid = GrNewWindow(pwid, x, y, width, height,
			  border_size, bg, border_color);

	if (wid == 0)
		return NULL;

	if ((widget=(mvp_widget_t*)malloc(sizeof(*widget))) == NULL)
		return NULL;
	memset(widget, 0, sizeof(*widget));

	widget->wid = wid;
	widget->parent = parent;
	widget->x = x;
	widget->y = y;
	widget->width = width;
	widget->height = height;
	widget->bg = bg;
	widget->border_color = border_color;
	widget->border_size = border_size;
	widget->user_data = NULL;

	if (add_widget(widget) < 0)
		goto err;

	widget->event_mask = GR_EVENT_MASK_EXPOSURE;

	GrSelectEvents(wid, widget->event_mask);

	return widget;

 err:
	if (widget)
		mvpw_destroy(widget);

	return NULL;
}
Esempio n. 2
0
static void
destroy(mvp_widget_t *widget)
{
	int r, c, i;
	if (widget->data.array.col_labels) {
		for(c=0;c<widget->data.array.cols+1;c++) {
			if(widget->data.array.col_labels[c]) {
				mvpw_destroy(widget->data.array.col_labels[c]);
			}
		}
		free(widget->data.array.col_labels);
	}
	if (widget->data.array.row_labels) {
		for(r=0;r<widget->data.array.rows;r++) {
			if(widget->data.array.row_labels[r]) {
				mvpw_destroy(widget->data.array.row_labels[r]);
			}
		}
		free(widget->data.array.row_labels);
	}
	if(widget->data.array.cells) {
		for(r = 0; r < widget->data.array.rows; r++)
			for(c = 0; c < widget->data.array.cols; c++) {
				i = widget->data.array.cols * r + c;
				if(widget->data.array.cells[i]) {
					mvpw_destroy(widget->data.array.cells[i]);
				}
			}
		free(widget->data.array.cells);
	}
	if(widget->data.array.cell_viz)
		free(widget->data.array.cell_viz);
	if(widget->data.array.cell_data)
		free(widget->data.array.cell_data);
	if(widget->data.array.cell_theme)
		free(widget->data.array.cell_theme);
}
Esempio n. 3
0
static void
video_subtitle_display(mvp_widget_t *widget)
{
	spu_item_t *spu;

	spu = demux_spu_get_next(handle);

	if (spu) {
		char *image;

		if ((image=demux_spu_decompress(handle, spu)) != NULL) {
			mvpw_bitmap_attr_t bitmap;

			if (spu_widget) {
				mvpw_hide(spu_widget);
				mvpw_expose(root);
				mvpw_destroy(spu_widget);
			}

			spu_widget = mvpw_create_bitmap(NULL,
							spu->x, spu->y,
							spu->w, spu->h,
							0, 0, 0);

			bitmap.image = image;

			/*
			 * XXX: we really should wait until the proper
			 *      moment to display the subtitle
			 */
			if (spu_widget) {
				mvpw_set_bitmap(spu_widget, &bitmap);
				mvpw_lower(spu_widget);
				mvpw_show(spu_widget);
				mvpw_expose(spu_widget);
			}

			free(image);
		} else {
			printf("fb: got subtitle, decompress failed\n");
		}

		free(spu);
	}
}
Esempio n. 4
0
void
back_to_guide_menu()
{
	
		disable_osd();
		if ( !running_replaytv ) {
			video_thumbnail(AV_THUMBNAIL_EIGTH,VID_THUMB_BOTTOM_RIGHT);
		}
		if (spu_widget) {
			mvpw_hide(spu_widget);
			mvpw_expose(root);
			mvpw_destroy(spu_widget);
			spu_widget = NULL;
			mvpw_set_timer(root, NULL, 0);
		}
		mvpw_hide(osd_widget);
		mvpw_hide(mute_widget);
		mvpw_hide(pause_widget);
		mvpw_hide(ffwd_widget);
		mvpw_hide(zoom_widget);
		display_on = 0;
		zoomed = 0;
		switch (gui_state) {
		case MVPMC_STATE_NONE:
		case MVPMC_STATE_EMULATE:
		case MVPMC_STATE_EMULATE_SHUTDOWN:
		case MVPMC_STATE_WEATHER:
			/*
			 * XXX: redisplay the main menu?
			 */
			break;
		case MVPMC_STATE_MYTHTV:
		case MVPMC_STATE_MYTHTV_SHUTDOWN:
			printf("%s(): %d\n", __FUNCTION__, __LINE__);
			if (mythtv_livetv == 1) {
				if (mythtv_state == MYTHTV_STATE_LIVETV) {
					if (mvpw_visible(mythtv_browser) || new_live_tv) {
						mythtv_livetv_stop();
						mythtv_livetv = 0;
						running_mythtv = 0;
						if(new_live_tv) {
							switch_gui_state(MVPMC_STATE_MYTHTV);
							mvpw_show(mythtv_logo);
							mvpw_show(mythtv_menu);
							mvpw_focus(mythtv_menu);
						}
					} else {
						mvpw_show(mythtv_channel);
						mvpw_show(mythtv_date);
						mvpw_show(mythtv_description);
						mvpw_show(mythtv_logo);
						mvpw_show(mythtv_browser);
						mvpw_focus(mythtv_browser);
						video_thumbnail(AV_THUMBNAIL_EIGTH,VID_THUMB_BOTTOM_RIGHT);
					}
				} else if (mythtv_state == MYTHTV_STATE_MAIN) {
					mvpw_show(mythtv_logo);
					mvpw_show(mythtv_menu);
				} else {
					mythtv_show_widgets();
				}
			} else if (mythtv_main_menu) {
				mvpw_show(mythtv_logo);
				mvpw_show(mythtv_menu);
				mvpw_focus(mythtv_menu);
			} else if (running_mythtv) {
				printf("%s(): %d\n", __FUNCTION__, __LINE__);
				mythtv_show_widgets();
				mvpw_focus(mythtv_browser);
			}
			break;
		case MVPMC_STATE_REPLAYTV:
		case MVPMC_STATE_REPLAYTV_SHUTDOWN:
			video_playing = 0;
			replaytv_back_from_video();
			break;
		case MVPMC_STATE_FILEBROWSER:
		case MVPMC_STATE_FILEBROWSER_SHUTDOWN:
		case MVPMC_STATE_HTTP:
		case MVPMC_STATE_HTTP_SHUTDOWN:
			if (playlist) {
				mvpw_show(fb_progress);
				mvpw_show(playlist_widget);
				mvpw_focus(playlist_widget);
			} else {
				mvpw_show(fb_progress);
				mvpw_show(file_browser);
				mvpw_focus(file_browser);
			}
			break;
		case MVPMC_STATE_MCLIENT:
		case MVPMC_STATE_MCLIENT_SHUTDOWN:
			/*
			 * No code is necessary here because:
			 * - The key is already trapped / processed in gui.c/mclient_key_callback.
			 * - And the mclient show / focus is in gui.c/main_select_callback.
			 */
			break;
		}
		mvpw_expose(root);
}