Exemplo n.º 1
0
/*!
  \brief logview mouse button event handler
  \param widget is the pointer to logviewer drawingarea
  \param event is the pointer to EventButton structure
  \param data is unused
  \returns TRUE if handled, FALSE otherwise
  */
G_MODULE_EXPORT gboolean lv_mouse_button_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
	gint x = 0;
	gint y = 0;
	gint w = 0;
	gint h = 0;
	guint tnum = 0;
	guint state;
	extern Logview_Data *lv_data;
	Viewable_Value *v_value = NULL;
	GtkAllocation allocation;

	x = event->x;
	y = event->y;
	gtk_widget_get_allocation(widget,&allocation);
	w=allocation.width;
	h=allocation.height;
	state = event->state;

	return FALSE;

	/*printf("button with event is %i\n",event->button);
	 *printf("state of event is %i\n",state);
	 */
	if (x > lv_data->info_width) /* If out of bounds just return... */
		return TRUE;

	if (lv_data->active_traces == 0)
		return TRUE;
	tnum = (guint)ceil(y/lv_data->spread);
	if (tnum >= g_list_length(lv_data->tlist))
		return TRUE;
	v_value = (Viewable_Value *)g_list_nth_data(lv_data->tlist,tnum);
	if (event->state & (GDK_BUTTON3_MASK))
	{
		/*printf("right button released... \n");*/
		v_value->highlight = FALSE;
		gdk_draw_rectangle(lv_data->pixmap,
				gtk_widget_get_style(widget)->black_gc,
				TRUE, lv_data->info_width,0,
				w-lv_data->info_width,h);
		trace_update(TRUE);
		highlight_tinfo(tnum,TRUE);
		return TRUE;

	}
	else if (event->button == 3) /* right mouse button */
	{
		/*printf("right button pushed... \n");*/
		v_value->highlight = TRUE;
		gdk_draw_rectangle(lv_data->pixmap,
				gtk_widget_get_style(widget)->black_gc,
				TRUE, lv_data->info_width,0,
				w-lv_data->info_width,h);
		trace_update(TRUE);
		highlight_tinfo(tnum,TRUE);
		return TRUE;
	}
	return TRUE;
}
Exemplo n.º 2
0
/*! 
  \brief lv_configure_event() is the logviewer configure event that gets called
  whenever the display is resized or created
  \param widget is the pointer to widget receiving event
  \param event is the pointer to Config event structure
  \param data is unused)
  \returns FALSE
  */
G_MODULE_EXPORT gboolean lv_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
{
	GdkPixmap *pixmap = NULL;
	GdkPixmap *pmap = NULL;
	GtkAllocation allocation;
	GdkWindow *window = gtk_widget_get_window(widget);

	gtk_widget_get_allocation(widget,&allocation);
	/* Get pointer to backing pixmap ... */
	if (!lv_data)
	{
		lv_data = g_new0(Logview_Data,1);
		lv_data->traces = g_hash_table_new(g_str_hash,g_str_equal);
	}
	pixmap = lv_data->pixmap;
	pmap = lv_data->pmap;
			
	if (window)
	{
		if (pixmap)
			g_object_unref(pixmap);

		if (pmap)
			g_object_unref(pmap);

		gint w = allocation.width;
		gint h = allocation.height;
		pixmap=gdk_pixmap_new(window,
				w,h,
				gtk_widget_get_visual(widget)->depth);
		gdk_draw_rectangle(pixmap,
				gtk_widget_get_style(widget)->black_gc,
				TRUE, 0,0,
				w,h);
		pmap=gdk_pixmap_new(window,
				w,h,
				gtk_widget_get_visual(widget)->depth);
		gdk_draw_rectangle(pmap,
				gtk_widget_get_style(widget)->black_gc,
				TRUE, 0,0,
				w,h);
		gdk_window_set_back_pixmap(window,pixmap,0);
		lv_data->pixmap = pixmap;
		lv_data->pmap = pmap;

		if ((lv_data->traces) && (g_list_length(lv_data->tlist) > 0))
		{
			draw_infotext();
			trace_update(TRUE);
		}
		gdk_window_clear(window);
	}

	return FALSE;
}
Exemplo n.º 3
0
/*!
  \brief pb_update_logview_traces() updates each trace in turn and then scrolls 
  the display
  \param force_redraw flag to force all data to be redrawn not 
  just the new data...
  \returns TRUE
  */
G_MODULE_EXPORT gboolean pb_update_logview_traces(gboolean force_redraw)
{

	if (!DATA_GET(global_data,"playback_mode"))
		return TRUE;
	if ((lv_data->traces) && (g_list_length(lv_data->tlist) > 0))
	{
		adj_scale = TRUE;
		g_static_mutex_lock(&update_mutex);
		trace_update(force_redraw);
		g_static_mutex_unlock(&update_mutex);
		scroll_logviewer_traces();
	}
	return TRUE;
}