Example #1
0
/**************************************************************************
 The Area Selection rectangle. Called by center_tile_mapcanvas() and
 when the mouse pointer moves.
**************************************************************************/
void update_rect_at_mouse_pos(void)
{
  int canvas_x, canvas_y;

  if (!rbutton_down) {
    return;
  }

  /* Reading the mouse pos here saves event queueing. */
  gdk_window_get_pointer(gtk_widget_get_window(map_canvas), &canvas_x, &canvas_y, NULL);
  update_selection_rectangle(canvas_x, canvas_y);
}
Example #2
0
void draw_selection(GtkWidget * widget, gdouble x, gdouble y, gpointer data, int ctrl_mask)
{
  int xmin, xmax, ymin, ymax;
  TxPoint point;

  if (sc->point_courant_leto.x > x)
  {
    xmin = x;
    xmax = sc->point_courant_leto.x;
  }
  else
  {
    xmax = x;
    xmin = sc->point_courant_leto.x;
  }

  if (sc->point_courant_leto.y > y)
  {
    ymin = y;
    ymax = sc->point_courant_leto.y;
  }
  else
  {
    ymax = y;
    ymin = sc->point_courant_leto.y;
  }

  point.x = x;
  point.y = y;

  update_selection_rectangle(xmin, ymin, xmax, ymax, ctrl_mask);
  scroll(point, (TxDonneesFenetre *) data);
  regenerer_test(((TxDonneesFenetre *) data));

  /* Paint to the pixmap, where we store our state */
  gdk_draw_rectangle(((TxDonneesFenetre *) data)->pixmap, widget->style->black_gc, FALSE, xmin, ymin, xmax - xmin, ymax - ymin);

  /* Now invalidate the affected region of the drawing area. */
  /*gdk_window_invalidate_rect(widget->window, &sc->selection_update_rect, FALSE);*/
}