Exemplo n.º 1
0
	void draw(BITMAP * buffer) {
		if (image == NULL)
			draw_bounding_box(buffer);
		else
			pivot_sprite(buffer, 
						image, 
						pos.x, 
						pos.y, 
						image_offset.x, 
						image_offset.y, 
						itofix(angle*(128/PI)));
	}
Exemplo n.º 2
0
static int
unit_spheremonics (ModeInfo *mi,
                   int resolution, Bool wire, int *m, XColor *colors)
{
  spheremonics_configuration *cc = &ccs[MI_SCREEN(mi)];
  int polys = 0;
  int i, j;
  double du, dv;
  XYZ q[4];
  XYZ n[4];
  int res = (wire == 2
             ? resolution / 2
             : resolution);

  cc->bbox[0].x = cc->bbox[0].y = cc->bbox[0].z = 0;
  cc->bbox[1].x = cc->bbox[1].y = cc->bbox[1].z = 0;

  du = (M_PI+M_PI) / (double)res; /* Theta */
  dv = M_PI        / (double)res; /* Phi   */

  if (wire)
    glColor3f (1, 1, 1);

  glBegin (wire ? GL_LINE_LOOP : GL_QUADS);

  for (i = 0; i < res; i++) {
    double u = i * du;
    for (j = 0; j < res; j++) {
      double v = j * dv;
      q[0] = sphere_eval (u, v, m);
      n[0] = calc_normal(q[0],
                         sphere_eval (u+du/10, v, m),
                         sphere_eval (u, v+dv/10, m));
      glNormal3f(n[0].x,n[0].y,n[0].z);
      if (!wire) do_color (i, colors);
      glVertex3f(q[0].x,q[0].y,q[0].z);

      q[1] = sphere_eval (u+du, v, m);
      n[1] = calc_normal(q[1],
                         sphere_eval (u+du+du/10, v, m),
                         sphere_eval (u+du, v+dv/10, m));
      glNormal3f(n[1].x,n[1].y,n[1].z);
      if (!wire) do_color ((i+1)%res, colors);
      glVertex3f(q[1].x,q[1].y,q[1].z);

      q[2] = sphere_eval (u+du, v+dv, m);
      n[2] = calc_normal(q[2],
                         sphere_eval (u+du+du/10, v+dv, m),
                         sphere_eval (u+du, v+dv+dv/10, m));
      glNormal3f(n[2].x,n[2].y,n[2].z);
      if (!wire) do_color ((i+1)%res, colors);
      glVertex3f(q[2].x,q[2].y,q[2].z);

      q[3] = sphere_eval (u,v+dv, m);
      n[3] = calc_normal(q[3],
                         sphere_eval (u+du/10, v+dv, m),
                         sphere_eval (u, v+dv+dv/10, m));
      glNormal3f(n[3].x,n[3].y,n[3].z);
      if (!wire) do_color (i, colors);
      glVertex3f(q[3].x,q[3].y,q[3].z);

      polys++;

# define CHECK_BBOX(N) \
         if (q[(N)].x < cc->bbox[0].x) cc->bbox[0].x = q[(N)].x; \
         if (q[(N)].y < cc->bbox[0].y) cc->bbox[0].y = q[(N)].y; \
         if (q[(N)].z < cc->bbox[0].z) cc->bbox[0].z = q[(N)].z; \
         if (q[(N)].x > cc->bbox[1].x) cc->bbox[1].x = q[(N)].x; \
         if (q[(N)].y > cc->bbox[1].y) cc->bbox[1].y = q[(N)].y; \
         if (q[(N)].z > cc->bbox[1].z) cc->bbox[1].z = q[(N)].z

      CHECK_BBOX(0);
      CHECK_BBOX(1);
      CHECK_BBOX(2);
      CHECK_BBOX(3);
# undef CHECK_BBOX
    }
  }
  glEnd();

  {
    GLfloat w = cc->bbox[1].x - cc->bbox[0].x;
    GLfloat h = cc->bbox[1].y - cc->bbox[0].y;
    GLfloat d = cc->bbox[1].z - cc->bbox[0].z;
    GLfloat wh = (w > h ? w : h);
    GLfloat hd = (h > d ? h : d);
    GLfloat scale = (wh > hd ? wh : hd);

    cc->scale = 1/scale;

    if (wire < 2 && (do_bbox || do_grid))
      {
        GLfloat s = scale * 1.5;
        glPushMatrix();
        glScalef(s, s, s);
        draw_bounding_box (mi);
        glPopMatrix();
      }
  }
  return polys;
}
Exemplo n.º 3
0
/* Constructs the GL shapes of the current molecule
 */
static void
build_molecule (ModeInfo *mi, Bool transparent_p)
{
  molecule_configuration *mc = &mcs[MI_SCREEN(mi)];
  int wire = MI_IS_WIREFRAME(mi);
  int i;
  GLfloat alpha = transparent_p ? shell_alpha : 1.0;
  int polys = 0;

  molecule *m = &mc->molecules[mc->which];

  if (wire)
    {
      glDisable(GL_CULL_FACE);
      glDisable(GL_LIGHTING);
      glDisable(GL_LIGHT0);
      glDisable(GL_DEPTH_TEST);
      glDisable(GL_NORMALIZE);
      glDisable(GL_CULL_FACE);
    }
  else
    {
      glEnable(GL_CULL_FACE);
      glEnable(GL_LIGHTING);
      glEnable(GL_LIGHT0);
      glEnable(GL_DEPTH_TEST);
      glEnable(GL_NORMALIZE);
      glEnable(GL_CULL_FACE);
    }

  if (!wire)
    set_atom_color (mi, 0, False, alpha);

  if (do_bonds)
    for (i = 0; i < m->nbonds; i++)
      {
        const molecule_bond *b = &m->bonds[i];
        const molecule_atom *from = get_atom (m->atoms, m->natoms, b->from);
        const molecule_atom *to   = get_atom (m->atoms, m->natoms, b->to);

        if (wire)
          {
            glBegin(GL_LINES);
            glVertex3f(from->x, from->y, from->z);
            glVertex3f(to->x,   to->y,   to->z);
            glEnd();
            polys++;
          }
        else
          {
            int faces = (mc->scale_down ? TUBE_FACES_2 : TUBE_FACES);
# ifdef SMOOTH_TUBE
            int smooth = True;
# else
            int smooth = False;
# endif
            GLfloat thickness = 0.07 * b->strength;
            GLfloat cap_size = 0.03;
            if (thickness > 0.3)
              thickness = 0.3;

            polys += tube (from->x, from->y, from->z,
                           to->x,   to->y,   to->z,
                           thickness, cap_size,
                           faces, smooth, (!do_atoms || do_shells), wire);
          }
      }

  if (!wire && do_atoms)
    for (i = 0; i < m->natoms; i++)
      {
        const molecule_atom *a = &m->atoms[i];
        GLfloat size = atom_size (a);
        set_atom_color (mi, a, False, alpha);
        polys += sphere (mc, a->x, a->y, a->z, size, wire);
      }

  if (do_bbox && !transparent_p)
    {
      draw_bounding_box (mi);
      polys += 4;
    }

  mc->polygon_count += polys;
}
Exemplo n.º 4
0
/* Constructs the GL shapes of the current molecule
 */
static void
build_molecule (ModeInfo *mi)
{
  molecule_configuration *mc = &mcs[MI_SCREEN(mi)];
  int wire = cur_wire;
  int i;

  molecule *m = &mc->molecules[mc->which];

  if (wire)
    {
      glDisable(GL_CULL_FACE);
      glDisable(GL_LIGHTING);
      glDisable(GL_LIGHT0);
      glDisable(GL_DEPTH_TEST);
      glDisable(GL_NORMALIZE);
      glDisable(GL_CULL_FACE);
    }
  else
    {
      glEnable(GL_CULL_FACE);
      glEnable(GL_LIGHTING);
      glEnable(GL_LIGHT0);
      glEnable(GL_DEPTH_TEST);
      glEnable(GL_NORMALIZE);
      glEnable(GL_CULL_FACE);
    }

  if (!wire)
    set_atom_color (mi, 0, False);

  if (do_bonds)
    for (i = 0; i < m->nbonds; i++)
      {
        molecule_bond *b = &m->bonds[i];
        molecule_atom *from = get_atom(m->atoms, m->natoms, b->from,
		MI_IS_VERBOSE(mi));
        molecule_atom *to   = get_atom(m->atoms, m->natoms, b->to,
		MI_IS_VERBOSE(mi));

        if (wire)
          {
            glBegin(GL_LINES);
            glVertex3f(from->x, from->y, from->z);
            glVertex3f(to->x,   to->y,   to->z);
            glEnd();
          }
        else
          {
            int faces = (scale_down ? TUBE_FACES_2 : TUBE_FACES);
# ifdef SMOOTH_TUBE
            int smooth = True;
# else
            int smooth = False;
# endif
            GLfloat thickness = 0.07 * b->strength;
            GLfloat cap_size = 0.03;
            if (thickness > 0.3)
              thickness = 0.3;

            tube (from->x, from->y, from->z,
                  to->x,   to->y,   to->z,
                  thickness, cap_size,
                  faces, smooth, !do_atoms, wire);
          }
      }

  for (i = 0; i < m->natoms; i++)
    {
      molecule_atom *a = &m->atoms[i];
      int i;

      if (!wire && do_atoms)
        {
          GLfloat size = atom_size (a);
          set_atom_color (mi, a, False);
          sphere (a->x, a->y, a->z, size, wire);
        }

      if (do_labels)
        {
          glPushAttrib (GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT);
          glDisable (GL_LIGHTING);
          glDisable (GL_DEPTH_TEST);

          if (!wire)
            set_atom_color (mi, a, True);

          glRasterPos3f (a->x, a->y, a->z);

          {
            GLdouble mm[17], pm[17];
            GLint vp[5];
            GLdouble wx=-1, wy=-1, wz=-1;
            glGetDoublev (GL_MODELVIEW_MATRIX, mm);
            glGetDoublev (GL_PROJECTION_MATRIX, pm);
            glGetIntegerv (GL_VIEWPORT, vp);

            /* Convert 3D coordinates to window coordinates */
            gluProject (a->x, a->y, a->z, mm, pm, vp, &wx, &wy, &wz);

            /* Fudge the window coordinates to center the string */
            wx -= string_width (mc->xfont1, a->label) / 2;
            wy -= mc->xfont1->descent;

            /* Convert new window coordinates back to 3D coordinates */
            gluUnProject (wx, wy, wz, mm, pm, vp, &wx, &wy, &wz);
            glRasterPos3f (wx, wy, wz);
          }

          for (i = 0; i < (int) strlen(a->label); i++)
            glCallList (mc->font1_dlist + (int)(a->label[i]));

          glPopAttrib();
        }
    }

  if (do_bbox)
    draw_bounding_box (mi);

  if (do_titles && m->label && *m->label)
    print_title_string (mi, m->label,
                        10, MI_HEIGHT(mi) - 10,
                        mc->xfont2->ascent + mc->xfont2->descent);
}
Exemplo n.º 5
0
//==========================
//  Process Function
//==========================
void
ffos_process_image (unsigned char *data, int w, int h) {
  int threshold = otsu_i(data, w, h);
  global_cfg.otsu_threshold = threshold;
#ifndef __SOLVER__
  printf("otsu threshold: %d\n",threshold);
#endif
  // temporary data after image processing
  unsigned char * _temp = malloc(w * h * sizeof(unsigned char));
  unsigned char * pbuf  = malloc(w * h * sizeof(unsigned char));
  int erosion_count = global_cfg.erosion_count;
  memcpy(_temp, data, w * h * sizeof(unsigned char));
  binarization(pbuf, data, threshold, w, h);
  // erosion on the binary image
  for(int count = 1; count <= erosion_count; count++){
#ifndef __SOLVER__
    printf("erosion count = %d\n", count);
#endif
    erode(pbuf, w, h);
  }// end count
  // for temporary debug
#ifndef __SOLVER__
  write_pgm(pbuf, w, h, "erosion.pgm");
#endif

  int * x_point      = malloc(w*sizeof(int));
  int * y_point      = malloc(h*sizeof(int));
  int   num_center_x = calculate_x_position(pbuf, x_point, w, h);
  int   num_center_y = calculate_y_position(pbuf, y_point, w, h);
  global_cfg.num_x = num_center_x;
  global_cfg.num_y = num_center_y;
#ifndef __SOLVER__
  draw_bounding_box(_temp, w, h, x_point, y_point, num_center_x, num_center_y);
  // for temporary debug
  write_pgm((unsigned char *)_temp, w, h, "BondBox.pgm");
#endif
  //  localize the middle detected oled
  // firstly, locate the center oled (more complex methods can be used!)
    
  // coordinate of the middle led
  int index_center_x = num_center_x/2; 
  int index_center_y = num_center_y/2; 
  // approximate center of oled
  int   center_x = x_point[index_center_x];
  int   center_y = y_point[index_center_y];
  // decide the bonding box (consider the corner cases)
  rectangle box = get_bounding_box(center_x, center_y, w, h);

  int cog_x_i, cog_y_i;
  center_of_gravity_i(&cog_x_i, &cog_y_i, data, w, &box);
  global_cfg.cog_x_c = cog_x_i;
  global_cfg.cog_y_c = cog_y_i;

    
  free(x_point);
  free(y_point); 
  free(pbuf   );
  free(_temp  );
#ifndef __SOLVER__
  //Processing finished, print the results
  printf("==========================\n");
  printf("detected x positions = %d \n", num_center_x);
  printf("detected y positions = %d \n", num_center_y);
  printf("detected OLED = %d\n", num_center_x * num_center_y);
  if( (num_center_x == 0) || (num_center_y == 0) ){
    printf("WARNING: no OLED detected!!!\n");
  }
  printf("==========================\n");
    
  printf("index_center_x = %d\n", index_center_x);
  printf("index_center_y = %d\n", index_center_y);
  printf("num_center_x = %d\n", num_center_x);
  printf("num_center_y = %d\n", num_center_y);
  printf("==========================\n");
  printf("==========================\n");
  printf("Bonding Box of Center OLED\n");
  printf("(y_NW ,x_NW) = (%d, %d)\n", box.y_nw, box.x_nw);
  printf("(y_SE ,x_SE) = (%d, %d)\n", box.y_se, box.x_se);
  printf("==========================\n");
  printf("Calculated (moment) x, y position of the middle OLED\n");
  printf("x position of center OLED = %d (INT)\n", cog_x_i);
  printf("y position of center OLED = %d (INT)\n", cog_y_i);
  printf("==========================\n");
#endif
} // end process_image()
gboolean working_area_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
	// Local variables
	gint				box_height;					// Height of the bounding box
	gint				box_width;					// Width of the bounding box
	GList				*collision_list = NULL;
	guint				count_int;
	gint				finish_x;					// X position at the layer objects finish time
	gint				finish_y;					// Y position at the layer objects finish time
	GList				*layer_pointer;
	GString				*message;					// Used to construct message strings
	guint				num_collisions;
	gint				onscreen_bottom;			// Y coordinate of bounding box bottom
	gint				onscreen_left;				// X coordinate of bounding box left
	gint				onscreen_right;				// X coordinate of bounding box right
	gint				onscreen_top;				// Y coordinate of bounding box top
	gint				pixmap_height;				// Height of the front store
	gint				pixmap_width;				// Width of the front store
	gfloat				scaled_height_ratio;		// Used to calculate a vertical scaling ratio
	gfloat				scaled_width_ratio;			// Used to calculate a horizontal scaling ratio
	gint				selected_row;				// Holds the number of the row that is selected
	gint				start_x;					// X position at the layer objects start time
	gint				start_y;					// Y position at the layer objects start time
	layer 				*this_layer_data;			// Pointer to the data for the selected layer
	slide				*this_slide_data;			// Alias to make things easier
	guint				tmp_int;					// Temporary integer


	// Only do this function if we have a front store available and a project loaded
	if ((NULL == get_front_store()) || (FALSE == get_project_active()))
	{
		return TRUE;
	}

	// Set the delete key focus to be layers
	set_delete_focus(FOCUS_LAYER);

	// Change the focus of the window to be this widget
	gtk_widget_grab_focus(GTK_WIDGET(widget));

	// Initialise some things
	this_slide_data = get_current_slide_data();
	gdk_drawable_get_size(GDK_PIXMAP(get_front_store()), &pixmap_width, &pixmap_height);

	// Check for primary mouse button click
	if (1 != event->button)
	{
		// Not a primary mouse click, so return
		return TRUE;
	}

	// Reset the mouse drag toggle
	set_mouse_dragging(FALSE);

	// Check if this was a double mouse click.  If it was, open an edit dialog
	if (GDK_2BUTTON_PRESS == event->type)
	{
		// Open an edit dialog
		layer_edit();

		return TRUE;
	}

	// Check if this was a triple mouse click.  If it was, ignore it
	if (GDK_3BUTTON_PRESS == event->type)
	{
		return TRUE;
	}

	// If we're presently creating a new highlight layer, store the mouse coordinates
	if (TYPE_HIGHLIGHT == get_new_layer_selected())
	{
		// Save the mouse coordinates
		set_stored_x(event->x);
		set_stored_y(event->y);

		// Reset the invalidation area
		set_invalidation_end_x(event->x);
		set_invalidation_end_y(event->y);
		set_invalidation_start_x(event->x - 1);
		set_invalidation_start_y(event->y - 1);

		return TRUE;
	}

	// If the user has clicked on the start or end points for the selected layer, we
	// don't want to do the collision detection below that changes layers
	if (END_POINTS_INACTIVE == get_end_point_status())
	{
		// * Check if the user is clicking on the layer start or end points *

		// Calculate the height and width scaling values for the main drawing area at its present size
		scaled_height_ratio = (gfloat) get_project_height() / (gfloat) pixmap_height;
		scaled_width_ratio = (gfloat) get_project_width() / (gfloat) pixmap_width;

		// Determine which row is selected in the time line
		selected_row = time_line_get_selected_layer_num(this_slide_data->timeline_widget);
		layer_pointer = g_list_first(this_slide_data->layers);
		this_layer_data = g_list_nth_data(layer_pointer, selected_row);

		// If the layer data isn't accessible, then don't run this function
		if (NULL == this_layer_data)
		{
			return TRUE;
		}

		// Calculate start and end points
		finish_x = (this_layer_data->x_offset_finish / scaled_width_ratio) + END_POINT_HORIZONTAL_OFFSET;
		finish_y = (this_layer_data->y_offset_finish / scaled_height_ratio) + END_POINT_VERTICAL_OFFSET;
		start_x = (this_layer_data->x_offset_start / scaled_width_ratio) + END_POINT_HORIZONTAL_OFFSET;
		start_y = (this_layer_data->y_offset_start / scaled_height_ratio) + END_POINT_VERTICAL_OFFSET;

		// Is the user clicking on an end point?
		if (((event->x >= start_x)							// Start point
			&& (event->x <= start_x + END_POINT_WIDTH)
			&& (event->y >= start_y)
			&& (event->y <= start_y + END_POINT_HEIGHT)) ||
			((event->x >= finish_x)							// End point
			&& (event->x <= finish_x + END_POINT_WIDTH)
			&& (event->y >= finish_y)
			&& (event->y <= finish_y + END_POINT_HEIGHT)))
		{
			// Retrieve the layer size information
			switch (this_layer_data->object_type)
			{
				case TYPE_EMPTY:
					// We can't drag an empty layer, so reset things and return
					set_mouse_dragging(FALSE);
					set_end_point_status(END_POINTS_INACTIVE);
					set_stored_x(-1);
					set_stored_y(-1);
					return TRUE;

				case TYPE_HIGHLIGHT:
					box_width = ((layer_highlight *) this_layer_data->object_data)->width;
					box_height = ((layer_highlight *) this_layer_data->object_data)->height;
					break;

				case TYPE_GDK_PIXBUF:
					// If this is the background layer, then we ignore it
					if (TRUE == this_layer_data->background)
					{
						set_mouse_dragging(FALSE);
						set_end_point_status(END_POINTS_INACTIVE);
						set_stored_x(-1);
						set_stored_y(-1);
						return TRUE;
					}

					// No it's not, so process it
					box_width = ((layer_image *) this_layer_data->object_data)->width;
					box_height = ((layer_image *) this_layer_data->object_data)->height;
					break;

				case TYPE_MOUSE_CURSOR:
					box_width = ((layer_mouse *) this_layer_data->object_data)->width;
					box_height = ((layer_mouse *) this_layer_data->object_data)->height;
					break;

				case TYPE_TEXT:
					box_width = ((layer_text *) this_layer_data->object_data)->rendered_width;
					box_height = ((layer_text *) this_layer_data->object_data)->rendered_height;
					break;

				default:
					message = g_string_new(NULL);
					g_string_printf(message, "%s ED377: %s", _("Error"), _("Unknown layer type."));
					display_warning(message->str);
					g_string_free(message, TRUE);

					return TRUE;  // Unknown layer type, so no idea how to extract the needed data for the next code
			}

			// Work out the bounding box boundaries (scaled)
			if ((event->x >= start_x)							// Left
				&& (event->x <= start_x + END_POINT_WIDTH)		// Right
				&& (event->y >= start_y)						// Top
				&& (event->y <= start_y + END_POINT_HEIGHT))	// Bottom
			{
				// Start point clicked
				onscreen_left = this_layer_data->x_offset_start / scaled_width_ratio;
				onscreen_top = this_layer_data->y_offset_start / scaled_width_ratio;;
				onscreen_right = (this_layer_data->x_offset_start + box_width) / scaled_height_ratio;
				onscreen_bottom = (this_layer_data->y_offset_start + box_height) / scaled_height_ratio;
			} else
			{
				// End point clicked
				onscreen_left = this_layer_data->x_offset_finish / scaled_width_ratio;
				onscreen_top = this_layer_data->y_offset_finish / scaled_width_ratio;;
				onscreen_right = (this_layer_data->x_offset_finish + box_width) / scaled_height_ratio;
				onscreen_bottom = (this_layer_data->y_offset_finish + box_height) / scaled_height_ratio;
			}

			// Ensure the bounding box doesn't go out of bounds
			onscreen_left = CLAMP(onscreen_left, 2, pixmap_width - 2);
			onscreen_top = CLAMP(onscreen_top, 2, pixmap_height - 2);
			onscreen_right = CLAMP(onscreen_right, 2, pixmap_width - 2);
			onscreen_bottom = CLAMP(onscreen_bottom, 2, pixmap_height - 2);

			// Draw a bounding box onscreen
			draw_bounding_box(onscreen_left, onscreen_top, onscreen_right, onscreen_bottom);

			// End point clicked, so we return in order to avoid the collision detection
			return TRUE;
		}
	}

	// * Do collision detection here to determine if the user has clicked on a layer's object *

	this_slide_data = get_current_slide_data();
	calculate_object_boundaries();
	collision_list = detect_collisions(collision_list, event->x, event->y);
	if (NULL == collision_list)
	{
		// If there was no collision, then select the background layer
		time_line_set_selected_layer_num(this_slide_data->timeline_widget, this_slide_data->num_layers - 1);  // *Needs* the -1, don't remove

		// Clear any existing handle box
		gdk_draw_drawable(GDK_DRAWABLE(get_main_drawing_area()->window), GDK_GC(get_main_drawing_area()->style->fg_gc[GTK_WIDGET_STATE(get_main_drawing_area())]),
				GDK_PIXMAP(get_front_store()), 0, 0, 0, 0, -1, -1);

		// Reset the stored mouse coordinates
		set_stored_x(-1);
		set_stored_y(-1);

		// Free the memory allocated during the collision detection
		g_list_free(collision_list);
		collision_list = NULL;

		return TRUE;
	}

	// * To get here there must have been at least one collision *

	// Save the mouse coordinates
	set_stored_x(event->x);
	set_stored_y(event->y);

	// Determine which layer the user has selected in the timeline
	selected_row = time_line_get_selected_layer_num(this_slide_data->timeline_widget);

	// Is the presently selected layer in the collision list?
	collision_list = g_list_first(collision_list);
	num_collisions = g_list_length(collision_list);
	for (count_int = 0; count_int < num_collisions; count_int++)
	{
		collision_list = g_list_first(collision_list);
		collision_list = g_list_nth(collision_list, count_int);
		layer_pointer = g_list_first(this_slide_data->layers);
		tmp_int = g_list_position(layer_pointer, ((boundary_box *) collision_list->data)->layer_ptr);
		if (tmp_int == selected_row)
		{
			// Return if the presently selected row is in the collision list, as we don't want to change our selected layer
			return TRUE;
		}
	}

	// * To get here, the presently selected layer wasn't in the collision list *

	// The presently selected row is not in the collision list, so move the selection row to the first collision
	collision_list = g_list_first(collision_list);
	selected_row = g_list_position(this_slide_data->layers, ((boundary_box *) collision_list->data)->layer_ptr);
	time_line_set_selected_layer_num(this_slide_data->timeline_widget, selected_row);

	// Draw a handle box around the new selected object
	draw_handle_box();

	// Free the memory allocated during the collision detection
	g_list_free(collision_list);
	collision_list = NULL;

	return TRUE;
}