Bug fixes, smoothing transitions, removing not necessary code and rewriting some small details

master
Zwarf 2022-05-12 23:23:57 +02:00
rodzic 1388dc306d
commit 28bcffd74e
8 zmienionych plików z 133 dodań i 153 usunięć

Wyświetl plik

@ -224,7 +224,7 @@ int
{
elevation = coordinates_array[i*2+1];
if (elevation > upper_max)
if (elevation >= upper_max)
{
rise_upper_set_array[1] = i;
upper_max = elevation;
@ -295,3 +295,4 @@ int
return dark_blue_golden_array;
}

Wyświetl plik

@ -28,7 +28,7 @@ update_marker_visibility (PicplannerDrawLayer *layer,
ShumateViewport *viewport;
ShumateMapSource *map_source;
gboolean within_viewport;
double x, y;
double x, y, min_size, x_offset, y_offset, x_marker_offset, y_marker_offset;
int marker_width, marker_height;
int width, height;
@ -41,15 +41,30 @@ update_marker_visibility (PicplannerDrawLayer *layer,
x = picplanner_marker_get_x (marker);
y = picplanner_marker_get_y (marker);
x_marker_offset = picplanner_marker_get_x_offset (marker);
y_marker_offset = picplanner_marker_get_y_offset (marker);
width = gtk_widget_get_width (GTK_WIDGET (layer));
height = gtk_widget_get_height (GTK_WIDGET (layer));
if (width<height)
{
min_size = width;
x_offset = 0;
y_offset = (height-width)/2;
}
else
{
min_size = height;
x_offset = (width-height)/2;
y_offset = 0;
}
gtk_widget_measure (GTK_WIDGET (marker), GTK_ORIENTATION_HORIZONTAL, -1, 0, &marker_width, NULL, NULL);
gtk_widget_measure (GTK_WIDGET (marker), GTK_ORIENTATION_VERTICAL, -1, 0, &marker_height, NULL, NULL);
x = floorf (x - marker_width/2.f);
y = floorf (y - marker_height/2.f);
x = floorf (x*min_size + x_offset + x_marker_offset - marker_width/2.f);
y = floorf (y*min_size + y_offset + y_marker_offset- marker_height/2.f);
within_viewport = x > -marker_width && x <= width &&
y > -marker_height && y <= height &&
@ -87,7 +102,7 @@ picplanner_draw_layer_size_allocate (GtkWidget *widget,
child = gtk_widget_get_next_sibling (child))
{
gboolean within_viewport;
double x, y;
double x, y, min_size, x_offset, y_offset, x_marker_offset, y_marker_offset;
int marker_width, marker_height;
if (!gtk_widget_should_layout (child))
@ -95,12 +110,27 @@ picplanner_draw_layer_size_allocate (GtkWidget *widget,
x = picplanner_marker_get_x (PICPLANNER_MARKER (child));
y = picplanner_marker_get_y (PICPLANNER_MARKER (child));
x_marker_offset = picplanner_marker_get_x_offset (PICPLANNER_MARKER (child));
y_marker_offset = picplanner_marker_get_y_offset (PICPLANNER_MARKER (child));
if (width<height)
{
min_size = width;
x_offset = 0;
y_offset = (height-width)/2;
}
else
{
min_size = height;
x_offset = (width-height)/2;
y_offset = 0;
}
gtk_widget_measure (child, GTK_ORIENTATION_HORIZONTAL, -1, 0, &marker_width, NULL, NULL);
gtk_widget_measure (child, GTK_ORIENTATION_VERTICAL, -1, 0, &marker_height, NULL, NULL);
x = floorf (x - marker_width/2.f);
y = floorf (y - marker_height/2.f);
x = floorf (x*min_size + x_offset + x_marker_offset - marker_width/2.f);
y = floorf (y*min_size + y_offset + y_marker_offset- marker_height/2.f);
allocation.x = x;
allocation.y = y;
@ -166,7 +196,7 @@ picplanner_draw_layer_snapshot (GtkWidget *widget,
{
PicplannerDrawLayer *self = (PicplannerDrawLayer *)widget;
PicplannerDrawLayerPrivate *priv = picplanner_draw_layer_get_instance_private (self);
int width, height;
int width, height, min_size, x_offset, y_offset;
cairo_t *cr;
GtkWidget *child;
@ -177,6 +207,18 @@ picplanner_draw_layer_snapshot (GtkWidget *widget,
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
if (width<height)
{
min_size = width;
x_offset = 0;
y_offset = (height-width)/2;
}
else
{
min_size = height;
x_offset = (width-height)/2;
y_offset = 0;
}
if (!gtk_widget_get_visible (widget) || width <= 0 || height <= 0)
return;
@ -188,8 +230,8 @@ picplanner_draw_layer_snapshot (GtkWidget *widget,
for (uint i = 0; i < priv->nodes_len; i++)
{
double x, y;
x = priv->nodes_coordinates[i*2];
y = priv->nodes_coordinates[i*2+1];
x = priv->nodes_coordinates[i*2]*min_size+x_offset;
y = priv->nodes_coordinates[i*2+1]*min_size+y_offset;
cairo_line_to (cr, x, y);
}

Wyświetl plik

@ -9,6 +9,8 @@ typedef struct
{
double x;
double y;
double x_offset;
double y_offset;
GtkWidget *child;
} PicplannerMarkerPrivate;
@ -24,12 +26,16 @@ static GtkBuildableIface *parent_buildable_iface;
void
picplanner_marker_set_location (PicplannerMarker *marker,
double x,
double y)
double y,
double x_offset,
double y_offset)
{
PicplannerMarkerPrivate *priv = picplanner_marker_get_instance_private (marker);
priv->x = x;
priv->y = y;
priv->x_offset = x_offset;
priv->y_offset = y_offset;
}
@ -50,6 +56,23 @@ picplanner_marker_get_y (PicplannerMarker *marker)
return priv->y;
}
double
picplanner_marker_get_x_offset (PicplannerMarker *marker)
{
PicplannerMarkerPrivate *priv = picplanner_marker_get_instance_private (marker);
return priv->x_offset;
}
double
picplanner_marker_get_y_offset (PicplannerMarker *marker)
{
PicplannerMarkerPrivate *priv = picplanner_marker_get_instance_private (marker);
return priv->y_offset;
}
static void
picplanner_marker_add_child (GtkBuildable *buildable,
GtkBuilder *builder,

Wyświetl plik

@ -21,7 +21,9 @@ struct _PicplannerMarkerClass
void
picplanner_marker_set_location (PicplannerMarker *marker,
double x,
double y);
double y,
double x_offset,
double y_offset);
double
picplanner_marker_get_x (PicplannerMarker *marker);
@ -29,6 +31,12 @@ picplanner_marker_get_x (PicplannerMarker *marker);
double
picplanner_marker_get_y (PicplannerMarker *marker);
double
picplanner_marker_get_x_offset (PicplannerMarker *marker);
double
picplanner_marker_get_y_offset (PicplannerMarker *marker);
PicplannerMarker
*picplanner_marker_new (void);

Wyświetl plik

@ -71,6 +71,8 @@ picplanner_moon_set_rise_upper_set (PicplannerMoon *moon,
char_upper_elevation = g_strdup_printf ("Elevation: %.0f\u00B0",
coordinates_array[index_rise_upper_set[1]*2+1]);
g_print ("Azimuth Moon: %d\n", index_rise_upper_set[1]);
/*
* Set
*/

Wyświetl plik

@ -364,11 +364,8 @@ picplanner_overview_remove_map_content (PicplannerOverview *overview)
}
void
picplanner_overview_update_map_center (PicplannerOverview *overview,
double latitude,
double longitude)
picplanner_overview_update_map_center (PicplannerOverview *overview)
{
double x,y;
GtkWidget *image_center;
picplanner_draw_layer_remove_all (overview->pp_layer_center);
@ -376,20 +373,13 @@ picplanner_overview_update_map_center (PicplannerOverview *overview,
image_center = gtk_image_new_from_icon_name ("location-icon-symbolic-red");
gtk_image_set_pixel_size (GTK_IMAGE (image_center), ICON_SIZE_SMALL);
shumate_viewport_location_to_widget_coords (overview->viewport,
GTK_WIDGET (overview->map),
latitude, longitude,
&x, &y);
picplanner_marker_set_location (overview->pp_marker_center, x, y-ICON_SIZE_SMALL/2);
picplanner_marker_set_location (overview->pp_marker_center, 1./2., 1./2., 0, -ICON_SIZE_SMALL/2);
picplanner_marker_set_child (overview->pp_marker_center, image_center);
picplanner_draw_layer_add_marker (overview->pp_layer_center, overview->pp_marker_center);
}
void
picplanner_overview_update_map_sun (PicplannerOverview *overview,
double latitude,
double longitude,
double *array_coordinates_sun,
int current_index,
int *rise_upper_set_sun)
@ -398,9 +388,6 @@ picplanner_overview_update_map_sun (PicplannerOverview *overview,
static GdkRGBA sun_color = {1., 0.9, 0., 0.8};
static GdkRGBA sun_rise_set_color = {1., 0.8, 0., 0.5};
int width, height, min_size;
double x, y;
double x_sun, y_sun;
double x_sunrise, y_sunrise;
double x_sunset, y_sunset;
@ -418,35 +405,25 @@ picplanner_overview_update_map_sun (PicplannerOverview *overview,
gtk_image_set_pixel_size (GTK_IMAGE (image_sun), ICON_SIZE_LARGE);
gtk_widget_set_visible (image_sun, visible_sun);
shumate_viewport_location_to_widget_coords (overview->viewport,
GTK_WIDGET (overview->map),
latitude, longitude,
&x, &y);
width = gtk_widget_get_allocated_width (GTK_WIDGET (overview->map));
height = gtk_widget_get_allocated_height (GTK_WIDGET (overview->map));
if (width<height)
min_size = width;
else
min_size = height;
azimuth_sun = array_coordinates_sun[current_index*2];
x_sun = x + sin(calc_deg_to_rad (azimuth_sun)) * min_size * LENGTH_SCALE_FACTOR;
y_sun = y - cos(calc_deg_to_rad (azimuth_sun)) * min_size * LENGTH_SCALE_FACTOR;
x_sun = 1./2. + sin(calc_deg_to_rad (azimuth_sun)) * LENGTH_SCALE_FACTOR;
y_sun = 1./2. - cos(calc_deg_to_rad (azimuth_sun)) * LENGTH_SCALE_FACTOR;
azimuth_sunrise = array_coordinates_sun[rise_upper_set_sun[0]*2];
x_sunrise = x + sin(calc_deg_to_rad (azimuth_sunrise)) * min_size * LENGTH_SCALE_FACTOR;
y_sunrise = y - cos(calc_deg_to_rad (azimuth_sunrise)) * min_size * LENGTH_SCALE_FACTOR;
x_sunrise = 1./2. + sin(calc_deg_to_rad (azimuth_sunrise)) * LENGTH_SCALE_FACTOR;
y_sunrise = 1./2. - cos(calc_deg_to_rad (azimuth_sunrise)) * LENGTH_SCALE_FACTOR;
azimuth_sunset = array_coordinates_sun[rise_upper_set_sun[2]*2];
x_sunset = x + sin(calc_deg_to_rad (azimuth_sunset)) * min_size * LENGTH_SCALE_FACTOR;
y_sunset = y - cos(calc_deg_to_rad (azimuth_sunset)) * min_size * LENGTH_SCALE_FACTOR;
x_sunset = 1./2. + sin(calc_deg_to_rad (azimuth_sunset)) * LENGTH_SCALE_FACTOR;
y_sunset = 1./2. - cos(calc_deg_to_rad (azimuth_sunset)) * LENGTH_SCALE_FACTOR;
picplanner_marker_set_location (overview->pp_marker_sun, x_sun, y_sun);
picplanner_marker_set_location (overview->pp_marker_sun, x_sun, y_sun, 0, 0);
picplanner_marker_set_child (overview->pp_marker_sun, image_sun);
picplanner_draw_layer_add_marker (overview->pp_layer_sun, overview->pp_marker_sun);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_sun, x, y);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_sun, 1./2., 1./2.);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_sun, x_sun, y_sun);
picplanner_draw_layer_set_stroke_color (overview->pp_layer_sun, &sun_color);
picplanner_draw_layer_set_stroke_width (overview->pp_layer_sun, sun_stroke_width);
@ -454,7 +431,7 @@ picplanner_overview_update_map_sun (PicplannerOverview *overview,
if (rise_upper_set_sun[0]!=-1)
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_sun_rise_set, x_sunrise, y_sunrise);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_sun_rise_set, x, y);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_sun_rise_set, 1./2., 1./2.);
if (rise_upper_set_sun[2]!=-1)
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_sun_rise_set, x_sunset, y_sunset);
picplanner_draw_layer_set_stroke_color (overview->pp_layer_sun_rise_set, &sun_rise_set_color);
@ -463,8 +440,6 @@ picplanner_overview_update_map_sun (PicplannerOverview *overview,
void
picplanner_overview_update_map_moon (PicplannerOverview *overview,
double latitude,
double longitude,
double *array_coordinates_moon,
int current_index,
int *rise_upper_set_moon)
@ -473,9 +448,6 @@ picplanner_overview_update_map_moon (PicplannerOverview *overview,
static GdkRGBA moon_color = {0.8, 0.8, 0.8, 0.8};
static GdkRGBA moon_rise_set_color = {0.5, 0.5, 0.5, 0.5};
int width, height, min_size;
double x, y;
double x_moon, y_moon;
double x_moonrise, y_moonrise;
double x_moonset, y_moonset;
@ -493,35 +465,23 @@ picplanner_overview_update_map_moon (PicplannerOverview *overview,
gtk_image_set_pixel_size (GTK_IMAGE (image_moon), ICON_SIZE_LARGE);
gtk_widget_set_visible (image_moon, visible_moon);
shumate_viewport_location_to_widget_coords (overview->viewport,
GTK_WIDGET (overview->map),
latitude, longitude,
&x, &y);
width = gtk_widget_get_allocated_width (GTK_WIDGET (overview->map));
height = gtk_widget_get_allocated_height (GTK_WIDGET (overview->map));
if (width<height)
min_size = width;
else
min_size = height;
azimuth_moon = array_coordinates_moon[current_index*2];
x_moon = x + sin(calc_deg_to_rad (azimuth_moon)) * min_size * LENGTH_SCALE_FACTOR;
y_moon = y - cos(calc_deg_to_rad (azimuth_moon)) * min_size * LENGTH_SCALE_FACTOR;
x_moon = 1./2. + sin(calc_deg_to_rad (azimuth_moon)) * LENGTH_SCALE_FACTOR;
y_moon = 1./2. - cos(calc_deg_to_rad (azimuth_moon)) * LENGTH_SCALE_FACTOR;
azimuth_moonrise = array_coordinates_moon[rise_upper_set_moon[0]*2];
x_moonrise = x + sin(calc_deg_to_rad (azimuth_moonrise)) * min_size * LENGTH_SCALE_FACTOR;
y_moonrise = y - cos(calc_deg_to_rad (azimuth_moonrise)) * min_size * LENGTH_SCALE_FACTOR;
x_moonrise = 1./2. + sin(calc_deg_to_rad (azimuth_moonrise)) * LENGTH_SCALE_FACTOR;
y_moonrise = 1./2. - cos(calc_deg_to_rad (azimuth_moonrise)) * LENGTH_SCALE_FACTOR;
azimuth_moonset = array_coordinates_moon[rise_upper_set_moon[2]*2];
x_moonset = x + sin(calc_deg_to_rad (azimuth_moonset)) * min_size * LENGTH_SCALE_FACTOR;
y_moonset = y - cos(calc_deg_to_rad (azimuth_moonset)) * min_size * LENGTH_SCALE_FACTOR;
x_moonset = 1./2. + sin(calc_deg_to_rad (azimuth_moonset)) * LENGTH_SCALE_FACTOR;
y_moonset = 1./2. - cos(calc_deg_to_rad (azimuth_moonset)) * LENGTH_SCALE_FACTOR;
picplanner_marker_set_location (overview->pp_marker_moon, x_moon, y_moon);
picplanner_marker_set_location (overview->pp_marker_moon, x_moon, y_moon, 0 , 0);
picplanner_marker_set_child (overview->pp_marker_moon, image_moon);
picplanner_draw_layer_add_marker (overview->pp_layer_moon, overview->pp_marker_moon);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_moon, x, y);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_moon, 1./2., 1./2.);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_moon, x_moon, y_moon);
picplanner_draw_layer_set_stroke_color (overview->pp_layer_moon, &moon_color);
picplanner_draw_layer_set_stroke_width (overview->pp_layer_moon, moon_stroke_width);
@ -529,7 +489,7 @@ picplanner_overview_update_map_moon (PicplannerOverview *overview,
if (rise_upper_set_moon[0]!=-1)
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_moon_rise_set, x_moonrise, y_moonrise);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_moon_rise_set, x, y);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_moon_rise_set, 1./2., 1./2.);
if (rise_upper_set_moon[2]!=-1)
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_moon_rise_set, x_moonset, y_moonset);
picplanner_draw_layer_set_stroke_color (overview->pp_layer_moon_rise_set, &moon_rise_set_color);
@ -539,8 +499,6 @@ picplanner_overview_update_map_moon (PicplannerOverview *overview,
void
picplanner_overview_update_map_milky_way (PicplannerOverview *overview,
double latitude,
double longitude,
double *array_coordinates_milky_way,
int current_index,
int *rise_upper_set_milky_way)
@ -549,9 +507,6 @@ picplanner_overview_update_map_milky_way (PicplannerOverview *overview,
static GdkRGBA milky_way_color = {0.2, 0.2, 0.7, 0.8};
static GdkRGBA milky_way_rise_set_color = {0.0, 0.0, 0.4, 0.5};
int width, height, min_size;
double x, y;
double x_milky_way, y_milky_way;
double x_milky_way_rise, y_milky_way_rise;
double x_milky_way_set, y_milky_way_set;
@ -569,35 +524,23 @@ picplanner_overview_update_map_milky_way (PicplannerOverview *overview,
gtk_image_set_pixel_size (GTK_IMAGE (image_milky_way), ICON_SIZE_LARGE);
gtk_widget_set_visible (image_milky_way, visible_milky_way);
shumate_viewport_location_to_widget_coords (overview->viewport,
GTK_WIDGET (overview->map),
latitude, longitude,
&x, &y);
width = gtk_widget_get_allocated_width (GTK_WIDGET (overview->map));
height = gtk_widget_get_allocated_height (GTK_WIDGET (overview->map));
if (width<height)
min_size = width;
else
min_size = height;
azimuth_milky_way = array_coordinates_milky_way[current_index*2];
x_milky_way = x + sin(calc_deg_to_rad (azimuth_milky_way)) * min_size * LENGTH_SCALE_FACTOR;
y_milky_way = y - cos(calc_deg_to_rad (azimuth_milky_way)) * min_size * LENGTH_SCALE_FACTOR;
x_milky_way = 1./2. + sin(calc_deg_to_rad (azimuth_milky_way)) * LENGTH_SCALE_FACTOR;
y_milky_way = 1./2. - cos(calc_deg_to_rad (azimuth_milky_way)) * LENGTH_SCALE_FACTOR;
azimuth_milky_way_rise = array_coordinates_milky_way[rise_upper_set_milky_way[0]*2];
x_milky_way_rise = x + sin(calc_deg_to_rad (azimuth_milky_way_rise)) * min_size * LENGTH_SCALE_FACTOR;
y_milky_way_rise = y - cos(calc_deg_to_rad (azimuth_milky_way_rise)) * min_size * LENGTH_SCALE_FACTOR;
x_milky_way_rise = 1./2. + sin(calc_deg_to_rad (azimuth_milky_way_rise)) * LENGTH_SCALE_FACTOR;
y_milky_way_rise = 1./2. - cos(calc_deg_to_rad (azimuth_milky_way_rise)) * LENGTH_SCALE_FACTOR;
azimuth_milky_way_set = array_coordinates_milky_way[rise_upper_set_milky_way[2]*2];
x_milky_way_set = x + sin(calc_deg_to_rad (azimuth_milky_way_set)) * min_size * LENGTH_SCALE_FACTOR;
y_milky_way_set = y - cos(calc_deg_to_rad (azimuth_milky_way_set)) * min_size * LENGTH_SCALE_FACTOR;
x_milky_way_set = 1./2. + sin(calc_deg_to_rad (azimuth_milky_way_set)) * LENGTH_SCALE_FACTOR;
y_milky_way_set = 1./2. - cos(calc_deg_to_rad (azimuth_milky_way_set)) * LENGTH_SCALE_FACTOR;
picplanner_marker_set_location (overview->pp_marker_milky_way, x_milky_way, y_milky_way);
picplanner_marker_set_location (overview->pp_marker_milky_way, x_milky_way, y_milky_way, 0, 0);
picplanner_marker_set_child (overview->pp_marker_milky_way, image_milky_way);
picplanner_draw_layer_add_marker (overview->pp_layer_milky_way, overview->pp_marker_milky_way);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_milky_way, x, y);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_milky_way, 1./2., 1./2.);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_milky_way, x_milky_way, y_milky_way);
picplanner_draw_layer_set_stroke_color (overview->pp_layer_milky_way, &milky_way_color);
picplanner_draw_layer_set_stroke_width (overview->pp_layer_milky_way, milky_way_stroke_width);
@ -605,7 +548,7 @@ picplanner_overview_update_map_milky_way (PicplannerOverview *overview,
if (rise_upper_set_milky_way[0]!=-1)
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_milky_way_rise_set, x_milky_way_rise, y_milky_way_rise);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_milky_way_rise_set, x, y);
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_milky_way_rise_set, 1./2., 1./2.);
if (rise_upper_set_milky_way[2]!=-1)
picplanner_draw_layer_add_node_coordinates (overview->pp_layer_milky_way_rise_set, x_milky_way_set, y_milky_way_set);
picplanner_draw_layer_set_stroke_color (overview->pp_layer_milky_way_rise_set, &milky_way_rise_set_color);

Wyświetl plik

@ -40,30 +40,22 @@ void
picplanner_overview_remove_map_content (PicplannerOverview *overview);
void
picplanner_overview_update_map_center (PicplannerOverview *overview,
double latitude,
double longitude);
picplanner_overview_update_map_center (PicplannerOverview *overview);
void
picplanner_overview_update_map_sun (PicplannerOverview *overview,
double latitude,
double longitude,
double *array_coordinates_sun,
int current_index,
int *rise_upper_set_sun);
void
picplanner_overview_update_map_moon (PicplannerOverview *overview,
double latitude,
double longitude,
double *array_coordinates_moon,
int current_index,
int *rise_upper_set_moon);
void
picplanner_overview_update_map_milky_way (PicplannerOverview *overview,
double latitude,
double longitude,
double *array_coordinates_milky_way,
int current_index,
int *rise_upper_set_milky_way);

Wyświetl plik

@ -287,6 +287,7 @@ calculate_positions (PicplannerWindow *window)
rise_upper_set_index_moon = picplanner_get_index_rise_upper_set (array_coordinates_moon);
picplanner_overview_set_current_coordinates_moon (PICPLANNER_OVERVIEW (window->overview_box),
array_coordinates_moon,
rise_upper_set_index_moon,
@ -319,16 +320,12 @@ calculate_positions (PicplannerWindow *window)
/*
* Update Shumate Map
*/
picplanner_overview_update_map_center (PICPLANNER_OVERVIEW (window->overview_box),
latitude,
longitude);
picplanner_overview_update_map_center (PICPLANNER_OVERVIEW (window->overview_box));
if (g_settings_get_boolean (window->settings, "sun-visible"))
{
picplanner_overview_update_map_sun (PICPLANNER_OVERVIEW (window->overview_box),
latitude,
longitude,
array_coordinates_sun,
current_index,
rise_upper_set_index_sun);
@ -338,8 +335,6 @@ calculate_positions (PicplannerWindow *window)
if (g_settings_get_boolean (window->settings, "moon-visible"))
{
picplanner_overview_update_map_moon (PICPLANNER_OVERVIEW (window->overview_box),
latitude,
longitude,
array_coordinates_moon,
current_index,
rise_upper_set_index_moon);
@ -348,8 +343,6 @@ calculate_positions (PicplannerWindow *window)
if (g_settings_get_boolean (window->settings, "milky-way-visible"))
{
picplanner_overview_update_map_milky_way (PICPLANNER_OVERVIEW (window->overview_box),
latitude,
longitude,
array_coordinates_milky_way,
current_index,
rise_upper_set_index_milky_way);
@ -405,16 +398,12 @@ input_changed (GtkWidget *self,
{
(void) self;
PicplannerWindow *window;
double longitude, latitude;
if (PICPLANNER_IS_WINDOW (data_window_change))
window = PICPLANNER_WINDOW (data_window_change);
else
window = PICPLANNER_WINDOW (data_map_move);
longitude = gtk_spin_button_get_value (GTK_SPIN_BUTTON (window->east_entry));
latitude = gtk_spin_button_get_value (GTK_SPIN_BUTTON (window->north_entry));
if (window->input_new)
{
window->input_new = FALSE;
@ -423,7 +412,7 @@ input_changed (GtkWidget *self,
window);
}
picplanner_overview_update_map_center (PICPLANNER_OVERVIEW (window->overview_box), latitude, longitude);
picplanner_overview_update_map_center (PICPLANNER_OVERVIEW (window->overview_box));
window->input_count++;
}
@ -484,6 +473,7 @@ picplanner_window_init (PicplannerWindow *window)
window->settings = g_settings_new ("de.zwarf.picplanner");
g_settings_bind (window->settings, "longitude",
window->east_entry, "value",
G_SETTINGS_BIND_DEFAULT);
@ -511,36 +501,6 @@ picplanner_window_init (PicplannerWindow *window)
G_CALLBACK (input_changed),
window);
g_signal_connect (G_OBJECT (window->overview_box),
"ui-changed",
G_CALLBACK (input_changed_remove_content),
window);
g_signal_connect (G_OBJECT (window->search_bar),
"notify::search-mode-enabled",
G_CALLBACK (input_changed_remove_content),
window);
g_signal_connect (G_OBJECT (window->search_result_box),
"row-activated",
G_CALLBACK (search_location_chosen),
window);
g_signal_connect (G_OBJECT (window),
"notify::maximized",
G_CALLBACK (input_changed_remove_content),
window);
g_signal_connect (G_OBJECT (window),
"notify::default-width",
G_CALLBACK (input_changed_remove_content),
window);
g_signal_connect (G_OBJECT (window),
"notify::default-height",
G_CALLBACK (input_changed_remove_content),
window);
g_signal_connect (G_OBJECT (window->settings),
"changed::sun-visible",
G_CALLBACK (input_changed_remove_content),
@ -556,6 +516,10 @@ picplanner_window_init (PicplannerWindow *window)
G_CALLBACK (input_changed_remove_content),
window);
g_signal_connect (G_OBJECT (window->search_result_box),
"row-activated",
G_CALLBACK (search_location_chosen),
window);
/*
* Initialisation of values needed to detect when a user input ends
@ -570,4 +534,9 @@ picplanner_window_init (PicplannerWindow *window)
*/
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (window->search_bar), GTK_EDITABLE (window->search_entry));
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (window->search_bar), GTK_WIDGET (window));
/*
* Initial calculation after startup
*/
calculate_positions (window);
}