1748 |
return FALSE; |
return FALSE; |
1749 |
} |
} |
1750 |
|
|
1751 |
|
void map_state_reset(map_state_t *state) { |
1752 |
|
if(!state) return; |
1753 |
|
|
1754 |
|
state->zoom = 0.25; |
1755 |
|
state->detail = 1.0; |
1756 |
|
|
1757 |
|
/* todo: try to scroll to center of screen */ |
1758 |
|
state->scroll_offset.x = 0; |
1759 |
|
state->scroll_offset.y = 0; |
1760 |
|
} |
1761 |
|
|
1762 |
|
map_state_t *map_state_new(void) { |
1763 |
|
map_state_t *state = g_new0(map_state_t, 1); |
1764 |
|
map_state_reset(state); |
1765 |
|
return state; |
1766 |
|
} |
1767 |
|
|
1768 |
GtkWidget *map_new(appdata_t *appdata) { |
GtkWidget *map_new(appdata_t *appdata) { |
1769 |
map_t *map = appdata->map = g_new0(map_t, 1); |
map_t *map = appdata->map = g_new0(map_t, 1); |
1770 |
|
|
1780 |
map->state = appdata->project->map_state; |
map->state = appdata->project->map_state; |
1781 |
} else { |
} else { |
1782 |
printf("Creating new map state\n"); |
printf("Creating new map state\n"); |
1783 |
map->state = g_new0(map_state_t, 1); |
map->state = map_state_new(); |
|
map->state->zoom = 0.25; |
|
|
map->state->detail = 1.0; |
|
1784 |
} |
} |
1785 |
|
|
1786 |
map->state->refcount++; |
map->state->refcount++; |
1969 |
/* save changes to bg_offset in project */ |
/* save changes to bg_offset in project */ |
1970 |
appdata->project->wms_offset.x = map->bg.offset.x; |
appdata->project->wms_offset.x = map->bg.offset.x; |
1971 |
appdata->project->wms_offset.y = map->bg.offset.y; |
appdata->project->wms_offset.y = map->bg.offset.y; |
|
appdata->project->dirty = TRUE; |
|
1972 |
break; |
break; |
1973 |
|
|
1974 |
default: |
default: |
2405 |
map->state->detail = detail; |
map->state->detail = detail; |
2406 |
printf("changing detail factor to %f\n", map->state->detail); |
printf("changing detail factor to %f\n", map->state->detail); |
2407 |
|
|
2408 |
banner_busy_start(appdata, 1, "Redrawing..."); |
banner_busy_start(appdata, 1, _("Redrawing")); |
2409 |
map_clear(appdata, MAP_LAYER_OBJECTS_ONLY); |
map_clear(appdata, MAP_LAYER_OBJECTS_ONLY); |
2410 |
map_paint(appdata); |
map_paint(appdata); |
2411 |
banner_busy_stop(appdata); |
banner_busy_stop(appdata); |