| 402 | } |
| 403 | |
| 404 | void |
| 405 | ghack_map_cliparound(GtkWidget *win, int x, int y, gpointer data) |
| 406 | { |
| 407 | int map_width, map_height; |
| 408 | int to_x, to_y; |
| 409 | int cur_x, cur_y; |
| 410 | int width, height, half_width, half_height; |
| 411 | |
| 412 | x *= ghack_glyph_width() * ghack_map.zoom; |
| 413 | y *= ghack_glyph_height() * ghack_map.zoom; |
| 414 | map_width = COLNO * ghack_glyph_width() * ghack_map.zoom; |
| 415 | map_height = ROWNO * ghack_glyph_height() * ghack_map.zoom; |
| 416 | |
| 417 | gdk_window_get_size(GTK_LAYOUT(ghack_map.canvas)->bin_window, &width, |
| 418 | &height); |
| 419 | gnome_canvas_get_scroll_offsets(ghack_map.canvas, &cur_x, &cur_y); |
| 420 | |
| 421 | half_width = width * 0.5; |
| 422 | half_height = height * 0.5; |
| 423 | |
| 424 | if (((x - cur_x) < (width * 0.25)) || ((x - cur_x) > (width * 0.75))) { |
| 425 | to_x = ((x - half_width) > 0) ? x - half_width : 0; |
| 426 | to_x = ((x + half_width) > map_width) ? map_width - 2 * half_width |
| 427 | : to_x; |
| 428 | } else { |
| 429 | to_x = cur_x; |
| 430 | } |
| 431 | |
| 432 | if (((y - cur_y) < (height * 0.25)) || ((y - cur_y) > (height * 0.75))) { |
| 433 | to_y = ((y - half_height) > 0) ? y - half_height : 0; |
| 434 | to_y = ((y + half_height) > map_height) ? map_height - 2 * half_height |
| 435 | : to_y; |
| 436 | } else { |
| 437 | to_y = cur_y; |
| 438 | } |
| 439 | |
| 440 | if (to_x != cur_x || to_y != cur_y) |
| 441 | gnome_canvas_scroll_to(ghack_map.canvas, to_x, to_y); |
| 442 | // gnome_canvas_update_now ( ghack_map.canvas); |
| 443 | } |
| 444 | |
| 445 | void |
| 446 | ghack_reinit_map_window() |
no test coverage detected