From cad74f183cd277115b83d92cec65494a7949e9e2 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Tue, 2 Oct 2007 17:42:03 +0300 Subject: [PATCH] misc --- src/bt-bluez.c | 4 +- src/hildon-wrappers.c | 23 +++++------- src/map.c | 86 +++++++++++++++++++------------------------ 3 files changed, 50 insertions(+), 63 deletions(-) diff --git a/src/bt-bluez.c b/src/bt-bluez.c index 5d40a09..a1c206c 100644 --- a/src/bt-bluez.c +++ b/src/bt-bluez.c @@ -50,8 +50,8 @@ if (*_rcvr_mac != '/' && (getsockopt(_fd, SOL_SOCKET, SO_ERROR, &error, &size) | printf("%s(): Connected to receiver!\n", __PRETTY_FUNCTION__); set_conn_state(RCVR_UP); _input_sid = g_io_add_watch_full(_channel, G_PRIORITY_LOW, - G_IO_IN | G_IO_PRI, - channel_cb_input, NULL, NULL); + G_IO_IN | G_IO_PRI, + channel_cb_input, NULL, NULL); } _connect_sid = 0; diff --git a/src/hildon-wrappers.c b/src/hildon-wrappers.c index 4ce9187..4e9c895 100644 --- a/src/hildon-wrappers.c +++ b/src/hildon-wrappers.c @@ -46,6 +46,14 @@ _sb_sid=0; return FALSE; } +GtkWidget *hildon_note_new_confirmation(GtkWidget *widget, const gchar *text) +{ +return gtk_message_dialog_new(widget, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK_CANCEL, text); +} + void hildon_banner_show_information(GtkWidget *w, void *t, gchar *text) { gtk_statusbar_pop(GTK_STATUSBAR(_status_bar), 0); @@ -55,8 +63,7 @@ if (_sb_sid!=0) _sb_sid=g_timeout_add(6000, status_bar_clear, NULL); } -GtkWidget *hildon_banner_show_progress(GtkWidget * widget, GtkProgressBar *bar, - const gchar * text) +GtkWidget *hildon_banner_show_progress(GtkWidget * widget, GtkProgressBar *bar, const gchar * text) { gtk_widget_show(_progress_item); gtk_progress_bar_set_text(_progress_item, text); @@ -64,14 +71,6 @@ hildon_banner_show_information(_status_bar, NULL, text); return NULL; } -GtkWidget *hildon_note_new_confirmation(GtkWidget *widget, const gchar *text) -{ -return gtk_message_dialog_new(widget, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK_CANCEL, text); -} - void hildon_banner_set_fraction(GtkWidget * widget, gdouble fraction) { gtk_progress_bar_set_fraction(_progress_item, fraction); @@ -82,9 +81,7 @@ if (fraction==1.0) { gtk_widget_show(_progress_item); } -GtkWidget *hildon_banner_show_animation(GtkWidget *widget, - const gchar *animation_name, - const gchar *text) +GtkWidget *hildon_banner_show_animation(GtkWidget *widget, const gchar *animation_name, const gchar *text) { hildon_banner_show_information(_status_bar, NULL, text); gtk_widget_show(_progress_item); diff --git a/src/map.c b/src/map.c index 3bb8c86..a4f15a5 100644 --- a/src/map.c +++ b/src/map.c @@ -315,20 +315,17 @@ if (_home.valid) void map_force_redraw() { - guint new_x, new_y; - printf("%s()\n", __PRETTY_FUNCTION__); - - for (new_y = 0; new_y < BUF_HEIGHT_TILES; ++new_y) - for (new_x = 0; new_x < BUF_WIDTH_TILES; ++new_x) { - map_render_tile(_base_tilex + new_x, - _base_tiley + new_y, - new_x * TILE_SIZE_PIXELS, - new_y * TILE_SIZE_PIXELS, FALSE); - } - map_render_data(); - MACRO_QUEUE_DRAW_AREA(); +guint new_x, new_y; - vprintf("%s(): return\n", __PRETTY_FUNCTION__); +for (new_y = 0; new_y < BUF_HEIGHT_TILES; ++new_y) + for (new_x = 0; new_x < BUF_WIDTH_TILES; ++new_x) { + map_render_tile(_base_tilex + new_x, + _base_tiley + new_y, + new_x * TILE_SIZE_PIXELS, + new_y * TILE_SIZE_PIXELS, FALSE); + } +map_render_data(); +MACRO_QUEUE_DRAW_AREA(); } /** @@ -339,47 +336,41 @@ map_force_redraw() void map_set_zoom(guint new_zoom) { - printf("%s(%d)\n", __PRETTY_FUNCTION__, _zoom); - - /* Note that, since new_zoom is a guint and MIN_ZOOM is 0, this if - * condition also checks for new_zoom >= MIN_ZOOM. */ - if (new_zoom > (MAX_ZOOM - 1)) - return; - if (new_zoom == _zoom) - return; - - _zoom = new_zoom / _curr_repo->view_zoom_steps - * _curr_repo->view_zoom_steps; - _world_size_tiles = unit2tile(WORLD_SIZE_UNITS); - - /* If we're leading, update the center to reflect new zoom level. */ - MACRO_RECALC_CENTER(_center.unitx, _center.unity); +/* Note that, since new_zoom is a guint and MIN_ZOOM is 0, this if + * condition also checks for new_zoom >= MIN_ZOOM. */ +if (new_zoom > (MAX_ZOOM - 1)) + return; +if (new_zoom == _zoom) + return; - /* Update center bounds to reflect new zoom level. */ - _min_center.unitx = pixel2unit(grid2pixel(_screen_grids_halfwidth)); - _min_center.unity = pixel2unit(grid2pixel(_screen_grids_halfheight)); - _max_center.unitx = WORLD_SIZE_UNITS - grid2unit(_screen_grids_halfwidth) - 1; - _max_center.unity = WORLD_SIZE_UNITS - grid2unit(_screen_grids_halfheight) - 1; +_zoom = new_zoom / _curr_repo->view_zoom_steps * _curr_repo->view_zoom_steps; +_world_size_tiles = unit2tile(WORLD_SIZE_UNITS); - BOUND(_center.unitx, _min_center.unitx, _max_center.unitx); - BOUND(_center.unity, _min_center.unity, _max_center.unity); +/* If we're leading, update the center to reflect new zoom level. */ +MACRO_RECALC_CENTER(_center.unitx, _center.unity); - _base_tilex = grid2tile((gint) pixel2grid((gint) unit2pixel((gint) _center.unitx)) - - (gint) _screen_grids_halfwidth); - _base_tiley = grid2tile(pixel2grid(unit2pixel(_center.unity)) - - _screen_grids_halfheight); +/* Update center bounds to reflect new zoom level. */ +_min_center.unitx = pixel2unit(grid2pixel(_screen_grids_halfwidth)); +_min_center.unity = pixel2unit(grid2pixel(_screen_grids_halfheight)); +_max_center.unitx = WORLD_SIZE_UNITS - grid2unit(_screen_grids_halfwidth) - 1; +_max_center.unity = WORLD_SIZE_UNITS - grid2unit(_screen_grids_halfheight) - 1; - /* New zoom level, so we can't reuse the old buffer's pixels. */ +BOUND(_center.unitx, _min_center.unitx, _max_center.unitx); +BOUND(_center.unity, _min_center.unity, _max_center.unity); - /* Update state variables. */ - MACRO_RECALC_OFFSET(); - MACRO_RECALC_FOCUS_BASE(); - MACRO_RECALC_FOCUS_SIZE(); +_base_tilex = grid2tile((gint) pixel2grid((gint) unit2pixel((gint) _center.unitx)) + - (gint) _screen_grids_halfwidth); +_base_tiley = grid2tile(pixel2grid(unit2pixel(_center.unity)) + - _screen_grids_halfheight); - map_set_mark(); - map_force_redraw(); +/* New zoom level, so we can't reuse the old buffer's pixels. */ +/* Update state variables. */ +MACRO_RECALC_OFFSET(); +MACRO_RECALC_FOCUS_BASE(); +MACRO_RECALC_FOCUS_SIZE(); - vprintf("%s(): return\n", __PRETTY_FUNCTION__); +map_set_mark(); +map_force_redraw(); } /** @@ -391,7 +382,6 @@ map_center_unit(guint new_center_unitx, guint new_center_unity) gint new_base_tilex, new_base_tiley; guint new_x, new_y; guint j, k, base_new_x, base_old_x, old_x, old_y, iox, ioy; -g_printf("%s(%d, %d)\n", __PRETTY_FUNCTION__, new_center_unitx, new_center_unity); /* Assure that _center.unitx/y are bounded. */ BOUND(new_center_unitx, _min_center.unitx, _max_center.unitx); -- 2.39.5