Example #1
0
/**************************************************************************
...
**************************************************************************/
void scrollbar_scroll_callback(Widget w, XtPointer client_data,
			     XtPointer position_val)
{
  int position = XTPOINTER_TO_INT(position_val);
  int scroll_x, scroll_y, xstep, ystep;

  get_mapview_scroll_pos(&scroll_x, &scroll_y);
  get_mapview_scroll_step(&xstep, &ystep);

  if (!can_client_change_view()) {
    return;
  }

  if(w==map_horizontal_scrollbar) {
    if (position > 0) {
      scroll_x += xstep;
    } else {
      scroll_x -= xstep;
    }
  }
  else {
    if (position > 0) {
      scroll_y += ystep;
    } else {
      scroll_y -= ystep;
    }
  }

  set_mapview_scroll_pos(scroll_x, scroll_y);
  update_map_canvas_scrollbars();
}
Example #2
0
/**************************************************************************
...
**************************************************************************/
void scrollbar_jump_callback(GtkAdjustment *adj, gpointer hscrollbar)
{
  int scroll_x, scroll_y;

  if (!can_client_change_view()) {
    return;
  }

  get_mapview_scroll_pos(&scroll_x, &scroll_y);

  if (hscrollbar) {
    scroll_x = adj->value;
  } else {
    scroll_y = adj->value;
  }

  set_mapview_scroll_pos(scroll_x, scroll_y);
}
Example #3
0
/**************************************************************************
...
**************************************************************************/
void scrollbar_jump_callback(Widget w, XtPointer client_data,
			     XtPointer percent_ptr)
{
  float percent=*(float*)percent_ptr;
  int xmin, ymin, xmax, ymax, xsize, ysize;
  int scroll_x, scroll_y;

  if (!can_client_change_view()) {
    return;
  }

  get_mapview_scroll_window(&xmin, &ymin, &xmax, &ymax, &xsize, &ysize);
  get_mapview_scroll_pos(&scroll_x, &scroll_y);

  if(w==map_horizontal_scrollbar) {
    scroll_x = xmin + (percent * (xmax - xmin));
  } else {
    scroll_y = ymin + (percent * (ymax - ymin));
  }

  set_mapview_scroll_pos(scroll_x, scroll_y);
}